org.slf4j.profiler

## Class Profiler

- java.lang.Object
- - org.slf4j.profiler.Profiler

- All Implemented Interfaces:
    TimeInstrument

      public class Profiler
      extends Object
      implements TimeInstrument

  A poor man's profiler to measure the time elapsed performing some lengthy task.
  Author:
    Ceki Gülcü

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Profiler(String name)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `elapsedTime()` Time elapsed between start and stop, in nanoseconds.
    `List<TimeInstrument>` | `getCopyOfChildTimeInstruments()` Return a copy of the child instrument list for this Profiler instance.
    `StopWatch` | `getCopyOfGlobalStopWatch()` Return a copy of the global stopwatch of this Profiler instance.
    `Logger` | `getLogger()`
    `String` | `getName()` All time instruments are named entities.
    `ProfilerRegistry` | `getProfilerRegistry()`
    `org.slf4j.profiler.TimeInstrumentStatus` | `getStatus()`
    `void` | `log()` If the time instrument has an associated logger, then log information about this time instrument.
    `void` | `print()` Print information about this time instrument on the console.
    `void` | `registerWith(ProfilerRegistry profilerRegistry)`
    `void` | `setLogger(Logger logger)`
    `void` | `start(String name)` Starts a child stop watch and stops any previously started time instruments.
    `Profiler` | `startNested(String name)`
    `TimeInstrument` | `stop()` Stop this time instrument.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Profiler

          public Profiler(String name)

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `TimeInstrument`
      All time instruments are named entities.
      Specified by:
        `getName` in interface `TimeInstrument`
      Returns:
        the name of this instrument

    - #### getProfilerRegistry

          public ProfilerRegistry getProfilerRegistry()

    - #### registerWith

          public void registerWith(ProfilerRegistry profilerRegistry)

    - #### getLogger

          public Logger getLogger()

    - #### setLogger

          public void setLogger(Logger logger)

    - #### start

          public void start(String name)

      Starts a child stop watch and stops any previously started time instruments.
      Specified by:
        `start` in interface `TimeInstrument`

    - #### startNested

          public Profiler startNested(String name)

    - #### elapsedTime

          public long elapsedTime()

      Description copied from interface: `TimeInstrument`
      Time elapsed between start and stop, in nanoseconds.
      Specified by:
        `elapsedTime` in interface `TimeInstrument`
      Returns:
        time elapsed in nanoseconds

    - #### stop

          public TimeInstrument stop()

      Description copied from interface: `TimeInstrument`
      Stop this time instrument.
      Specified by:
        `stop` in interface `TimeInstrument`
      Returns:
        this

    - #### getStatus

          public org.slf4j.profiler.TimeInstrumentStatus getStatus()

      Specified by:
        `getStatus` in interface `TimeInstrument`

    - #### print

          public void print()

      Description copied from interface: `TimeInstrument`
      Print information about this time instrument on the console.
      Specified by:
        `print` in interface `TimeInstrument`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### log

          public void log()

      Description copied from interface: `TimeInstrument`
      If the time instrument has an associated logger, then log information about this time instrument. Note that `StopWatch` instances cannot log while `Profiler` instances can.
      Specified by:
        `log` in interface `TimeInstrument`

    - #### getCopyOfChildTimeInstruments

          public List<TimeInstrument> getCopyOfChildTimeInstruments()

      Return a copy of the child instrument list for this Profiler instance.
      Returns:
        a copy of this instance's child time instrument list
      Since:
        1.5.9

    - #### getCopyOfGlobalStopWatch

          public StopWatch getCopyOfGlobalStopWatch()

      Return a copy of the global stopwatch of this Profiler instance.
      Returns:
        a copy of this instance's global stop watch
      Since:
        1.5.9

Copyright © 2005–2017 QOS.ch. All rights reserved.