程序包 weka.core

类 Debug.Clock

java.lang.Object
weka.core.Debug.Clock
所有已实现的接口:
Serializable, RevisionHandler
封闭类:
Debug

public static class Debug.Clock extends Object implements Serializable, RevisionHandler
A little helper class for clocking and outputting times. It measures the CPU time if possible, otherwise it's just based on the system time. In case one just wants to measure time (e.g., database queries don't take up much CPU time, but still might take a long time to finish), then one can disable the use of CPU time as well.
版本:
$Revision: 7519 $
作者:
FracPete (fracpete at waikato dot ac dot nz)
另请参阅:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final int
    the output format in hours:minutes:seconds, with fraction of msecs
    static final int
    the output format in milli-seconds
    static final int
    the output format in seconds, with fraction of msecs
    int
    the format of the output
    static final Tag[]
    the output formats
  • 构造器概要

    构造器
    构造器
    说明
    automatically starts the clock with FORMAT_SECONDS format and CPU time if available
    Clock(boolean start)
    starts the clock depending on start immediately with the FORMAT_SECONDS output format and CPU time if available
    Clock(boolean start, int format)
    starts the clock depending on start immediately, using CPU time if available
    Clock(int format)
    automatically starts the clock with the given output format and CPU time if available
  • 方法概要

    修饰符和类型
    方法
    说明
    int
    returns the output format
    Returns the revision string.
    long
    returns the start time
    long
    returns the stop time or, if still running, the current time
    boolean
    returns whether the use of CPU is time is enabled/disabled (regardless whether the system supports it or not)
    boolean
    whether the measurement is based on the msecs returned from the System class or on the more accurate CPU time.
    boolean
    whether the time is still being clocked
    void
    setOutputFormat(int value)
    sets the format of the output
    void
    setUseCpuTime(boolean value)
    enables/disables the use of CPU time (if measurement of CPU time is available).
    void
    saves the current system time (or CPU time) in msec as start time
    void
    saves the current system (or CPU time) in msec as stop time
    returns the elapsed time, getStop() - getStart(), as string

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 字段详细资料

    • FORMAT_MILLISECONDS

      public static final int FORMAT_MILLISECONDS
      the output format in milli-seconds
      另请参阅:
    • FORMAT_SECONDS

      public static final int FORMAT_SECONDS
      the output format in seconds, with fraction of msecs
      另请参阅:
    • FORMAT_HHMMSS

      public static final int FORMAT_HHMMSS
      the output format in hours:minutes:seconds, with fraction of msecs
      另请参阅:
    • TAGS_FORMAT

      public static final Tag[] TAGS_FORMAT
      the output formats
    • m_OutputFormat

      public int m_OutputFormat
      the format of the output
  • 构造器详细资料

    • Clock

      public Clock()
      automatically starts the clock with FORMAT_SECONDS format and CPU time if available
      另请参阅:
    • Clock

      public Clock(int format)
      automatically starts the clock with the given output format and CPU time if available
      参数:
      format - the output format
      另请参阅:
    • Clock

      public Clock(boolean start)
      starts the clock depending on start immediately with the FORMAT_SECONDS output format and CPU time if available
      参数:
      start - whether to start the clock immediately
      另请参阅:
    • Clock

      public Clock(boolean start, int format)
      starts the clock depending on start immediately, using CPU time if available
      参数:
      start - whether to start the clock immediately
      format - the format
      另请参阅:
  • 方法详细资料

    • isCpuTime

      public boolean isCpuTime()
      whether the measurement is based on the msecs returned from the System class or on the more accurate CPU time. Also depends on whether the usage of the CPU time was disabled or enabled.
      返回:
      true if the more accurate CPU time of the thread is used and the use of CPU time hasn't been disabled
      另请参阅:
    • setUseCpuTime

      public void setUseCpuTime(boolean value)
      enables/disables the use of CPU time (if measurement of CPU time is available). The actual use of CPU time still depends on whether the system supports it. Resets the current timer, if running.
      参数:
      value - if true the CPU time is used (if possible)
    • getUseCpuTime

      public boolean getUseCpuTime()
      returns whether the use of CPU is time is enabled/disabled (regardless whether the system supports it or not)
      返回:
      true the CPU time is used (if possible)
    • start

      public void start()
      saves the current system time (or CPU time) in msec as start time
      另请参阅:
      • m_Start
    • stop

      public void stop()
      saves the current system (or CPU time) in msec as stop time
      另请参阅:
      • m_Stop
    • getStart

      public long getStart()
      returns the start time
      返回:
      the start time
    • getStop

      public long getStop()
      returns the stop time or, if still running, the current time
      返回:
      the stop time
    • isRunning

      public boolean isRunning()
      whether the time is still being clocked
      返回:
      true if the time is still being clocked
    • setOutputFormat

      public void setOutputFormat(int value)
      sets the format of the output
      参数:
      value - the format of the output
      另请参阅:
    • getOutputFormat

      public int getOutputFormat()
      returns the output format
      返回:
      the output format
      另请参阅:
    • toString

      public String toString()
      returns the elapsed time, getStop() - getStart(), as string
      覆盖:
      toString 在类中 Object
      返回:
      the elapsed time as string
      另请参阅:
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision