GATE
Version 3.1-2270

gate.util.profile
Class Profiler

java.lang.Object
  extended by gate.util.profile.Profiler

public class Profiler
extends Object


Constructor Summary
Profiler()
           
 
Method Summary
 String checkPoint(String execPointDescr)
          To be called at all execution points of interest.
 String checkPoint(String execPointDescr, String[] categories, boolean showDescr, boolean showStats, boolean memoryCheck)
          In addition to the variant of the method with two parameters allows: a set of categories (identified by strings) to which the preceeding fragment of code belongs; flag determining whether the description of the execution point to be displayed; flag determining whether the statistics to be shown
 void enable(boolean isEnabled)
          Switches the profiler ON and OFF.
 void enableGCCalling(boolean collect)
          Tell's the profiler whether to call the garbage collector when detecting memory usage or not.
 long getCategoryTimeLast(String category)
          Returns 0 if the category was not found
 long getCategoryTimeSum(String category)
          Returns 0 if the category was not found
 long getNetRunTime()
          Returns the time spend in the last run without the time spend by the profiler.
 long getProfilerTime()
          Returns the time spend by the profiler during the last run.
 long getRunDuration()
          Returns the time spend in the current run until the last check-point inclusive the time spend by the profiler.
 String initRun(String runDescription)
          Inialises the profiler for a new run
 boolean isEnabled()
          Answers is the profiler switched ON or OFF.
 boolean isGCCallingEnabled()
           
 void printCategAvg(String categ, long items, double volume, String whateverMeasure)
          An auxiliary routine printing time, avg. time, and avg. speed for a category
 String printSpeed(long timeMillis, double whatever, String whateverMeasure)
          An auxiliary routine printing in a string speed
 String printTime(long timeMillis)
          An auxiliary routine printing time in "nnn.nns" format
 void printToSystemOut(boolean doPrint)
          Sets the profiler to print (or not) to the standard output.
 void showCategoryTime(String categ)
          Prints the time for certain category of activities
 void showCategoryTimes()
          Prints the time for all the categories of activities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Profiler

public Profiler()
Method Detail

enable

public void enable(boolean isEnabled)
Switches the profiler ON and OFF. When OFF all the methods do nothing


isEnabled

public boolean isEnabled()
Answers is the profiler switched ON or OFF. When OFF all the methods do nothing


enableGCCalling

public void enableGCCalling(boolean collect)
Tell's the profiler whether to call the garbage collector when detecting memory usage or not. If switched ON the GC is called following a specific strategy as many time as needed so to collect all the memory that can be collected. This makes the profiling slower and also does not correctly account for the really memory usage of the applicaton when run without the profiler. On the other hand, with garbage collection, it is easier to detecet the amount of memory really necessary for the application.


isGCCallingEnabled

public boolean isGCCallingEnabled()
See Also:
enableGCCalling(boolean)

getProfilerTime

public long getProfilerTime()
Returns the time spend by the profiler during the last run. It is the case that net_run_time = run_duration - profiler_time


getNetRunTime

public long getNetRunTime()
Returns the time spend in the last run without the time spend by the profiler. It is the case that net_run_time = run_duration - profiler_time


getRunDuration

public long getRunDuration()
Returns the time spend in the current run until the last check-point inclusive the time spend by the profiler. It is the case that net_run_time = run_duration - profiler_time


initRun

public String initRun(String runDescription)
Inialises the profiler for a new run


checkPoint

public String checkPoint(String execPointDescr)
To be called at all execution points of interest. Detects the time and memory usage in absolute terms as well as compared to the previous execution point


checkPoint

public String checkPoint(String execPointDescr,
                         String[] categories,
                         boolean showDescr,
                         boolean showStats,
                         boolean memoryCheck)
In addition to the variant of the method with two parameters allows: a set of categories (identified by strings) to which the preceeding fragment of code belongs; flag determining whether the description of the execution point to be displayed; flag determining whether the statistics to be shown


getCategoryTimeSum

public long getCategoryTimeSum(String category)
Returns 0 if the category was not found


getCategoryTimeLast

public long getCategoryTimeLast(String category)
Returns 0 if the category was not found


showCategoryTimes

public void showCategoryTimes()
Prints the time for all the categories of activities


showCategoryTime

public void showCategoryTime(String categ)
Prints the time for certain category of activities


printTime

public String printTime(long timeMillis)
An auxiliary routine printing time in "nnn.nns" format


printSpeed

public String printSpeed(long timeMillis,
                         double whatever,
                         String whateverMeasure)
An auxiliary routine printing in a string speed


printCategAvg

public void printCategAvg(String categ,
                          long items,
                          double volume,
                          String whateverMeasure)
An auxiliary routine printing time, avg. time, and avg. speed for a category


printToSystemOut

public void printToSystemOut(boolean doPrint)
Sets the profiler to print (or not) to the standard output. The default behaviour is - print to std out.

Parameters:
doPrint - whether or not to print to std out.

GATE
Version 3.1-2270