기본 샘플 프로브

이 예제는 가장 공통적으로 사용되는 몇 가지 프로브 오브젝트를 예시합니다.

이 예제에서 프로브는 프로브된 메소드를 호출할 때마다 카운터에 1을 추가합니다. 프로브된 메소드를 처음 호출한 후 1000번째 호출할 때마다 System.out.println을 사용하여 카운터 값 및 카운터를 롤오버시키는 메소드 이름을 표시합니다.

<?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>

상위 주제: Probekit 예제

Copyright IBM Corporation and others 2000, 2004.