1   package org.slf4j.profiler;
2   
3   
4   /**
5    * This interface sets the methods that must be implemented by 
6    * {@link Profiler} and {@link  StopWatch} classes. It settles the 
7    * general feel of the profiler package.
8    * 
9    * @author Ceki Gülcü
10   *
11   */
12  public interface TimeInstrument {
13  
14    /**
15     * All time instruments are named entities.
16     * @return the name of this instrument
17     */
18    String getName();
19    
20    
21    TimeInstrumentStatus getStatus();
22    
23    /**
24     * Start tis time instrument.
25     * 
26     * @param name
27     */
28    void start(String name);
29    
30    /**
31     * Stop this time instrument.
32     * 
33     * @return this
34     */
35    TimeInstrument stop();
36  
37    /**
38     * Time elapsed between start and stop, in nanoseconds.
39     * 
40     * @return time elapsed in nanoseconds
41     */
42    long elapsedTime();
43    
44    /**
45     * Print information about this time instrument on the console.
46     */
47    void print();
48    
49    /**
50     * If the time instrument has an associated logger, then log information about 
51     * this time instrument. Note that {@link StopWatch} instances cannot log while {@link Profiler}
52     * instances can.
53     */
54    void log();
55  }