2

At JPL, we use model transformation techniques for our systems engineering work. We use the Eclipse QVTO implementation of OMG's QVT specification.

http://www.eclipse.org/modeling/m2m/downloads/index.php?project=qvtoml

However, the Eclipse QVTO compiler is frustratingly slow. With judicious application of Guava's cache, I've managed to make significant performance improvements to the Eclispe QVTO compiler. More could be done but with what I have, I would like to get a view of the effectiveness of the caching optimizations in place by monitoring the cache statistics at runtime; i.e, com.google.common.cache.CacheStats

Has anyone suggestions w.r.t. how to define a JProfiler custom telemetry probe to do this?

http://resources.ej-technologies.com/jprofiler/help/doc/indexRedirect.html?http&&&resources.ej-technologies.com/jprofiler/help/doc/helptopics/probes/custom.html

  • Nicolas.
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265

1 Answers1

0

For a single cache that you can access with a static method, it's fairly easy. In the custom probe wizard, set the meta-data script to

metaData.recordOnStartup(true);

metaData.telemetry(true);
metaData.addCustomTelemetry("Request count", Unit.PLAIN, 1f);
metaData.addCustomTelemetry("Hit count", Unit.PLAIN, 1f);
metaData.addCustomTelemetry("Hit rate", Unit.PERCENT, 1f);
metaData.addCustomTelemetry("Miss count", Unit.PLAIN, 1f);
metaData.addCustomTelemetry("Miss rate", Unit.PERCENT, 1f);
metaData.addCustomTelemetry("Load success count", Unit.PLAIN, 1f);
metaData.addCustomTelemetry("Load exception count", Unit.PLAIN, 1f);
metaData.addCustomTelemetry("Load exception rate", Unit.PERCENT, 1f);
metaData.addCustomTelemetry("Eviction count", Unit.PLAIN, 1f);
metaData.addCustomTelemetry("Total load time", Unit.MICROSECONDS, 1f);
metaData.addCustomTelemetry("Average load penalty", Unit.MICROSECONDS, 1f);

and the telemetry script to

import test.CacheTest;
import com.google.common.cache.*;

Cache cache = CacheTest.getSingleCache();
if (cache == null) {
    return;
}
CacheStats stats = cache.stats();
data[0] = (int)stats.requestCount();
data[1] = (int)stats.hitCount();
data[2] = (int)(stats.hitRate() * 100);
data[3] = (int)stats.missCount();
data[4] = (int)(stats.missRate() * 100);
data[5] = (int)stats.loadSuccessCount();
data[6] = (int)stats.loadExceptionCount();
data[7] = (int)(stats.loadExceptionRate() * 100);
data[8] = (int)stats.evictionCount();
data[9] = (int)stats.totalLoadTime() / 1000;
data[10] = (int)stats.averageLoadPenalty() / 1000;

where CacheTest.getSingleCache() is the hook to get at your cache.

This will get you telemetry for all cache statistics measurements, like shown in the screen shot below:

enter image description here

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • Thanks! What do you suggest for multiple caches? – Nicolas Rouquette Oct 25 '11 at 18:30
  • Say, a GraphTest class that would have a graphs variable as shown in the CacheBuilder doc: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/CacheBuilder.html – Nicolas Rouquette Oct 25 '11 at 18:48
  • You could merge multiple caches for the telemetries in the same way. A per-cache view would be something for the control objects view, but that's currently not possible since control objects can only be updated by events and not periodically. A dedicated Guava cache probe is in the JProfiler issue tracker and will be available for 7.1 or 8.0. – Ingo Kegel Oct 25 '11 at 19:23