Class TimeTracer

  • All Implemented Interfaces:
    java.io.Serializable

    public class TimeTracer
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Constructor Detail

      • TimeTracer

        public TimeTracer​(java.lang.String description)
      • TimeTracer

        public TimeTracer​(java.lang.String description,
                          TimeTracer parent)
    • Method Detail

      • getInstance

        public static TimeTracer getInstance​(java.lang.String name,
                                             int autoreport)
      • getTime

        public long getTime()
      • getOrCreateChild

        protected TimeTracer getOrCreateChild​(java.lang.String childName)
      • getChild

        protected TimeTracer getChild​(java.lang.String childName)
      • start

        public void start​(java.lang.String childPathName)
      • start

        public void start()
      • checkParentStateWhenAdding

        protected void checkParentStateWhenAdding()
      • stop

        public void stop​(java.lang.String childPathName)
      • stop

        public void stop()
      • checkParentStateWhenRemoving

        protected void checkParentStateWhenRemoving()
      • finish

        public void finish()
      • finishAll

        public void finishAll()
      • getPathName

        protected java.lang.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 java.lang.Object execute​(java.lang.String key,
                                               int autoreport,
                                               TimeTracer.TraceBody body)
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception