object Profiler
The object implements a number of named timers and named counters. Code can be timed, with the time taken added to that of the named timer. Similarly, the number of times particular points in the code are reached can be counted, with the count recorded against a named counter.
The normal usages are:
Profiler.time("timer-name"){ code }
, which timescode
, recording the time against timertimer-name
, and returns the result ofcode
;Profiler.count("counter-name")
, which adds one onto countercounter-name
;Profiler.report
which gives a summary of the profiling.
Note that normal scoping rules apply. In code such as
Profiler.time("answer"){ val x = 6*7 }
, the scope of x
will be just
the inner statement; normal use would be
val x = Profiler.time("answer"){ 6*7 }
.
For use with concurrent code, it is recommended to start by calling
setWorkers(p)
to set the number of concurrent threads to p
(8 by default). If two threads have the same ID (mod p
) then they
may interfere, both in terms of correctness, and through creating cache
contention.
As with all profilers, there is a fairly significant overhead.
- Alphabetic
- By Inheritance
- Profiler
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clear: Unit
Clear all counters and timers.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def count(cname: String, increment: Int = 1): Unit
Increment the counter, recording it against the current thread.
Increment the counter, recording it against the current thread.
- increment
the amount of the increment (default 1).
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getCounter(name: String): Long
Get the value associated with a particular counter.
- def getReport: (List[(String, Long)], List[(String, Long)])
Get a summary of the profiler results.
Get a summary of the profiler results.
- returns
a pair(tPairs, cPairs), where tPairs gives the result for the timers as a List of (timer-name, time) pairs, and cPairs gives the result of the counters as a List of (counter-name, count) pairs.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def notime[A](tname: String)(cmd: => A): A
Do not time cmd.
Do not time cmd. This function is provided to allow timing to be easily turned on and off. Note, though, htat it has a non-zero cost.
- Annotations
- @inline()
- def report: Unit
Print report of all timers and counters.
- def setWorkers(p: Int): Unit
Set the number of concurrent workers
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def time[A](tname: String)(cmd: => A): A
Time cmd, recording the duration against the current thread
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()