An extension to Yammer Metrics exposing meters as Hotspot perf counters
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

metrics-perf is a tiny extension to yammer's metrics library exporting all metrics as Hotspot perf counters.

You can safely use this on a non-Hotspot VM as all Hotspot specific calls are done via reflection (i.e. no static import) and only executed if a compliant VM is detected.


To export all your metrics simply add this code:

final PerfReporter reporter = new PerfReporter(Metrics.defaultRegistry());
reporter.start(1, TimeUnit.SECONDS);

All perf counters values will then be updated every seconds.

Maven dependency

Add following dependency to your pom.xml:



Perf counters can be visualized by mainly 2 tools: VisualVM and jstat.

Using VisualVM

VisualVM can visualize perf counters via the tracer plugin.

Tracer plugin

Using JStat

jstat is a command line tool allowing to track perf counter values.

List all perf counters:

jstat -J-Djstat.showUnsupported=true -list <vmid>

List all exported metrics:

jstat -J-Djstat.showUnsupported=true -snap -name metric.\* <vmid>

Print current value of a particular metric:

jstat -J-Djstat.showUnsupported=true -snap -name metric.metric-name.15min-rate <vmid>

Sample value of a specific metric every 1 second:

jstat -J-Djstat.showUnsupported=true  -name metric.metric-name.15min-rate <vmid> 1s

You can find all jstat options (including non-documented) by browsing its source code.