A class that implements the PerformanceMonitor interface.
A performance monitor session consists of a start time [ call start
method ] and an end time [ call end method ].
This class tracks a number of system resources and provides the
ability to track system resource for delta's (between the start and
end of a session).
Each performance monitor session must include a call to first the
start and second the end methods in order
to measure system resource delta's. Once a proper session call sequence
has been made the application can then access the appropriate methods
to retrieve the desired system resource delta.
Once a call has been made to start method a new session
has been started. If the application calls end before
start an error will be returned.
In order to ensure data integrity the implemenation of the
PerformanceMonitor interface requires the application using the
interface always uses the interface with the proper calling sequence.
Below is an example of how an application would use the PerformanceMonitor
interface (and/or implemenation) correctly:
This example of code shows how an application might want to use
the PerformanceMonitor interface to measure read() I/O resources.
start = perfmon.start("read()"); // start a perfmon session
for (int i = 0 ; i < len ; i++ ) {
if ((ch = input.read()) != -1){
if (ch <= ' ') ch = ' ';
b.append((char) ch);
}
}
end = perfmon.end(); // end a perfmon session
perfmon.report(System.err); // print stdout standard report format
perfmon.write(System.err); // write key/value pair http-to-servlet
|