object
Profiler
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clear: Unit
-
def
clone(): AnyRef
-
def
count(cname: String): Unit
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
notime[A](tname: String)(cmd: ⇒ A): A
-
def
report: Unit
-
def
setWorkers(p: Int): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
time[A](tname: String)(cmd: ⇒ A): A
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
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 ofx
will be just the inner statement; normal use would beval 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 top
(8 by default). If two threads have the same ID (modp
) then they may interfere, both in terms of correctness, and through creating cache contention.As with all profilers, there is a fairly significant overhead.