A basic sample probe

This example 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>

Related concepts
Probekit overview

Related reference
The Probekit object

Copyright IBM Corporation and others 2000, 2003.