Class TraceSection

java.lang.Object
io.flutter.util.TraceSection
All Implemented Interfaces:
AutoCloseable

public final class TraceSection extends Object implements AutoCloseable
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    begin(String sectionName)
    Wraps Trace.beginSection to ensure that the line length stays below 127 code units.
    static void
    beginAsyncSection(String sectionName, int cookie)
    Wraps Trace.beginAsyncSection to ensure that the line length stays below 127 code units.
    void
     
    static void
    end()
    Wraps Trace.endSection.
    static void
    endAsyncSection(String sectionName, int cookie)
    Wraps Trace.endAsyncSection to ensure that the line length stays below 127 code units.
    scoped(String name)
    Factory used to support the try-with-resource construct.

    Methods inherited from class java.lang.Object

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

    • scoped

      public static TraceSection scoped(String name)
      Factory used to support the try-with-resource construct.

      To get scoped trace events, use the try-with-resource construct, for instance:

      
       try (TraceSection e = TraceSection.scoped("MyTraceEvent")) {
         // code.
       }
       
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • begin

      public static void begin(@NonNull String sectionName)
      Wraps Trace.beginSection to ensure that the line length stays below 127 code units.
      Parameters:
      sectionName - The string to display as the section name in the trace.
    • end

      public static void end() throws RuntimeException
      Wraps Trace.endSection.
      Throws:
      RuntimeException
    • beginAsyncSection

      public static void beginAsyncSection(String sectionName, int cookie)
      Wraps Trace.beginAsyncSection to ensure that the line length stays below 127 code units.
      Parameters:
      sectionName - The string to display as the section name in the trace.
      cookie - Unique integer defining the section.
    • endAsyncSection

      public static void endAsyncSection(String sectionName, int cookie)
      Wraps Trace.endAsyncSection to ensure that the line length stays below 127 code units.