이 예는 가장 일반적으로 사용하는 프로브 객체에 대해 설명합니다.
이 예에서 프로브는 프로브된 메소드를 호출할 때마다 카운터를 하나씩 추가합니다. 첫 번째 프로브된 메소드 호출 및 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 예