Class BvvProfiler

java.lang.Object
sc.fiji.snt.viewer.BvvProfiler

public final class BvvProfiler extends Object
Lightweight, opt-in profiling aid for the BVV/BDV viewers (Stream mode). Everything is controlled by JVM flags read once at class load. With no flag set, the switches below are static final constants: the JIT removes the timers entirely, so there is no per-call cost.
  • -Dsnt.profile=true: named timers (aggregated count/total/max per label, with calls on the EDT counted separately) and a summary table printed every -Dsnt.profile.reportSec (default 10). This is the only output
  • -Dsnt.profile.n5=true: also times N5Reader calls (see wrap(N5Reader))
  • -Dsnt.profile.slow=true: also prints each EDT call slower than -Dsnt.profile.slowMs (default 30)
  • -Dsnt.profile.edt=true: also starts an EDT monitor that adds two rows to the summary: the latency of a no-op posted to the EDT every 50 ms, and the number and duration of stalls longer than -Dsnt.profile.stallMs (default 150)
  • -Dsnt.profile.edt.dump=true: also dumps the EDT stack (and the lock it waits for) during each stall
Output lines are prefixed with [SNT-PROF]
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
     
    static void
    Prints the summary table now, sorted by total time
    static void
     
    static long
     
    static void
    Starts the periodic reporter and, if requested, the EDT monitor (idempotent)
    static void
    stop(String label, long token)
    Records the time elapsed since token under label
    static org.janelia.saalfeldlab.n5.N5Reader
    wrap(org.janelia.saalfeldlab.n5.N5Reader reader)
    Wraps reader in a proxy timing every call (labelled n5.<method>) and tracking concurrency.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isEnabled

      public static boolean isEnabled()
    • startIfEnabled

      public static void startIfEnabled()
      Starts the periodic reporter and, if requested, the EDT monitor (idempotent)
    • start

      public static long start()
      Returns:
      a start token for stop(String, long); 0 if disabled
    • stop

      public static void stop(String label, long token)
      Records the time elapsed since token under label
    • report

      public static void report()
      Prints the summary table now, sorted by total time
    • reset

      public static void reset()
    • wrap

      public static org.janelia.saalfeldlab.n5.N5Reader wrap(org.janelia.saalfeldlab.n5.N5Reader reader)
      Wraps reader in a proxy timing every call (labelled n5.<method>) and tracking concurrency. Returns reader itself if profiling is disabled or the proxy cannot be created. NB: code casting the result to a concrete reader class will fail