class CpuSampler extends Runnable
A lightweight CPU profiler based on call stack sampling.
When run as a thread, it periodically captures the call stacks of all live threads and maintains counters for each leaf method. The counters are then dumped to a logger with a given periodicity (most probably greater than the sampling period). Each data row written to the logger contains a timestamp, the method profiled, its location in the source code and the associated absolute counters and relative weight.
- Alphabetic
- By Inheritance
- CpuSampler
- Runnable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
CpuSampler(samplePeriod: Long = 100, flushPeriod: Long = 10000, logger: Logger = ...)
- samplePeriod
the period between each sample taken
- flushPeriod
the period between each flush to log
- logger
the logger to which results are written
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
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flush(timestamp: Long = System.currentTimeMillis()): Unit
Flushes the stored profiling data to the logger.
Flushes the stored profiling data to the logger.
- timestamp
the timestamp to use when writing the entries to the logger
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
run(): Unit
- Definition Classes
- CpuSampler → Runnable
-
def
sample(): Unit
Captures the current call stacks of all live threads and stores relevant profiling data about them.
-
def
shouldProfile(elem: StackTraceElement): Boolean
Returns a boolean value indicating if the stack trace element should be considered when profiling or not.
Returns a boolean value indicating if the stack trace element should be considered when profiling or not.
- elem
the stack trace element
- returns
trueif the stack trace element should be considered in profiling,falseotherwise.
-
def
stop(): Unit
Stops the data collecting and flushes the remaining data to the logger, causing the thread to stop eventually.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )