Skip to content

A simple manual profiler for manually instrumenting hot spots to track performance issues in Scala code.

License

Notifications You must be signed in to change notification settings

reactific/hotspot-profiler

Repository files navigation

License Build Status Coverage Status Release Downloads Join the chat at https://gitter.im/reactific/hotspot-profiler

Reactific HotSpot Profiler

This is a very simplistic tool aimed at focusing in on a particular hot spot where sampled profiling just isn't good enough. It is quite simple to use, just like this:

import com.reactific.hsp.Profiler

def myHotSpot = Profiler.profile("myHotSpot") {
  ...
}

The execution time of myHotSpot will be recorded, separately in each thread. After the test is over, you can write code to extract the results. To get a simple summary of the values, you can:

val (count, sum) = Profiler.get_one_item("myHotSpot")

to extract the number of invocations (count) and the sum of the execution times (sum) for the myHotSpot function. If you need fancier reporting you can also do something like:

log.debug(s"Profiling Results:\n${Profiler.format_profile_data.toString()}")

to print out all the results in a nested format for each thread.

Overhead is about 50 microseconds for each Profiler.profile call if profiling is enabled. When it is disabled, overhead is exactly one boolean dereference in an if statement and a function call (minimal).

About

A simple manual profiler for manually instrumenting hot spots to track performance issues in Scala code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages