Class TimeTracer

java.lang.Object
de.hybris.platform.util.TimeTracer
All Implemented Interfaces:
Serializable

public class TimeTracer extends Object implements Serializable
usage: create a hierarchy of time tracers
execute that task you want to have traces, starting and stopping the tracers (a child tracer must only be running if its parent is running)
if you want a intermediate report, call printReport()
call finishAll() in the root tracer after the task has finished, to get a final report

instead of creating a hierarchy of tracers, you can call start(String) with a path expression, which will create children automatically

to get reports automatically after n calls to stop(), call setAutoReport(int)

See Also:
  • Constructor Details

    • TimeTracer

      public TimeTracer(String description)
    • TimeTracer

      public TimeTracer(String description, TimeTracer parent)
  • Method Details

    • getInstance

      public static TimeTracer getInstance(String name, int autoreport)
    • getTime

      public long getTime()
    • getOrCreateChild

      protected TimeTracer getOrCreateChild(String childName)
    • getChild

      protected TimeTracer getChild(String childName)
    • start

      public void start(String childPathName)
    • start

      public void start()
    • checkParentStateWhenAdding

      protected void checkParentStateWhenAdding()
    • stop

      public void stop(String childPathName)
    • stop

      public void stop()
    • checkParentStateWhenRemoving

      protected void checkParentStateWhenRemoving()
    • finish

      public void finish()
    • finishAll

      public void finishAll()
    • getPathName

      protected String getPathName()
    • printInstanceReport

      public void printInstanceReport(int indent)
    • printReport

      public void printReport()
    • printReport

      protected void printReport(int indent)
    • setAutoReport

      public void setAutoReport(int autoReportPeriod)
      Parameters:
      autoReportPeriod - set to a value smaller than 1 to turn autoreport off
    • execute

      public static Object execute(String key, int autoreport, TimeTracer.TraceBody body) throws Exception
      Throws:
      Exception