This example demonstrates some of the most commonly used probe objects.
In this example, a probe adds one to a counter each time a probed method is called. At the first call to a probed method and then at every 1000th method call, it uses System.out.println to show the counter value and the name of the method that caused the counter to roll over.
<?xml version="1.0" encoding="ASCII"?>
<probekit>
<probe>
<fragmentAtClassScope>
static public int entry_counter = 0;
</fragmentAtClassScope>
<fragment type="entry">
<data type="className" name="_class" />
<data type="methodName" name="_method" />
<data type="args" name="_args" />
<code>
if ((entry_counter % 1000) == 0)
System.out.println("Counter value " + entry_counter +
" at a call to " + _class + "." + _method);
entry_counter++;
</code>
</fragment>
</probe>
</probekit>
Parent topic: Probekit Examples