Fields Summary |
---|
String | m_classnamethe class name of the object being tested - prints on report |
String | m_testnamethe testname of the application being tested - prints on report |
boolean | m_first_timefirst time logic flag |
long | m_start_tstart time for calling application |
long | m_end_tend time for calling application |
long | m_delta_ttotal time for calling application |
int[] | m_start_countall measurement start counters |
int[] | m_end_countall measurement end counters |
int[] | m_delta_countall measurement delta counters |
Methods Summary |
---|
public synchronized long | end()Ends the performance monitor timer and system measurements.
for (int i = 0; i < TOTAL_SYSTEM_PERFMON_COUNTERS; i++) {
m_end_count[i] = getStat(i);
}
m_end_t = System.currentTimeMillis();
return (m_end_t);
|
public int | getDelta(int perfmon_id)Gets the appropriate perfmon status delta measurement value between
a specific start and end time.
if ((m_start_count[INSTRUCTION_COUNTER] == 0) ||
(m_end_count[INSTRUCTION_COUNTER] == 0))
{
throw new
IllegalStateException("Invalid start/end sequence.");
}
if (perfmon_id < INSTRUCTION_COUNTER ||
perfmon_id > GARBAGE_COLLECTION_RESCANS) {
throw new
IllegalArgumentException("Invalid PerfMon measurement type");
}
return (int) (m_delta_count[perfmon_id] =
m_end_count[perfmon_id] -
m_start_count[perfmon_id]);
|
public long | getElapsedTime()Gets the current perfmon session elapsed time.
if ((m_start_count[INSTRUCTION_COUNTER] == 0) ||
(m_end_count[INSTRUCTION_COUNTER] == 0)) {
throw new
IllegalStateException("Invalid start/end sequence.");
}
return ((m_delta_t = m_end_t - m_start_t));
|
public long | getEndTime()Gets the current perfmon session end time.
return (m_end_t);
|
public long | getStartTime()Gets the current perfmon session start time.
return (m_start_t);
|
public int | getStat(int perfmon_id)Gets the appropriate and current perfmon stat value.
if (perfmon_id < INSTRUCTION_COUNTER ||
perfmon_id > GARBAGE_COLLECTION_RESCANS) {
throw new
IllegalArgumentException("Invalid PerfMon measurement type");
}
return (int)(sysGetCounter(perfmon_id));
|
public synchronized void | init()Initializes the performance monitor timer.
m_start_t = 0;
m_end_t = -1;
m_testname = null;
for (int i = 0; i < TOTAL_SYSTEM_PERFMON_COUNTERS; i++) {
m_start_count[i] = 0;
m_end_count[i] = 0;
m_delta_count[i] = 0;
}
|
public synchronized void | report(java.io.PrintStream printstream)Reports a standard perfmon output format to a PrintStream
which includes delta measurements (e.g. elapsed time) between
a specific start and end time.
Calendar cal = Calendar.getInstance();
TimeZone tz = TimeZone.getTimeZone("GMT");
cal.setTimeZone(tz);
m_delta_t = m_end_t - m_start_t;
for (int i = 0; i < TOTAL_SYSTEM_PERFMON_COUNTERS; i++) {
m_delta_count[i] = m_end_count[i] - m_start_count[i];
}
if (m_first_time) {
printstream.println("\n=====================================" +
"=====================================" +
"=====");
printstream.println("\t\t\tPerformance Monitor Tracing Report");
printstream.println("Application Name: ["+m_classname+"]");
printstream.println("Report Date: ["+toString(cal) + "]");
printstream.println("=====================================" +
"=====================================" +
"=====\n");
m_first_time = false;
}
printstream.println("-------------------------------------" +
"-------------------------------------" +
"-----");
printstream.println("Performance Monitor - Snapshot Analysis - ");
printstream.println("TimeStamp: \t\t["+toString(cal)+"]");
printstream.println("Class Name: \t\t["+m_classname+"]");
printstream.println("Test Name: \t\t["+m_testname+"]");
printstream.println("Elapsed Time : \t\t["+m_delta_t+
"] (milli-seconds)");
printstream.println("Classname: \t\t["+m_classname+"]");
printstream.println("Instruction Count: \t["+
m_delta_count[INSTRUCTION_COUNTER]+"]");
printstream.println("Thread Switch Count: \t["+
m_delta_count[THREAD_SWITCH_COUNTER]+"]");
printstream.println("Dynamic Object Count: \t["+
m_delta_count[DYNAMIC_OBJECT_COUNTER]+"]");
printstream.println("Dynamic Alloc Count: \t["+
m_delta_count[DYNAMIC_ALLOC_COUNTER]+"]");
printstream.println("Dynamic Dealloc Count: \t["+
m_delta_count[DYNAMIC_DEALLOC_COUNTER]+"]");
printstream.println("Garbage Collect Count: \t["+
m_delta_count[GARBAGE_COLLECTION_COUNTER]+"]");
printstream.println("GC Deferrals: \t\t["+
m_delta_count[TOTAL_GC_DEFERRALS]+"]");
printstream.println("Maximum GC Deferrals: \t["+
m_delta_count[MAX_GC_DEFERRALS]+"]");
printstream.println("Garbage Collect Rescans:["+
m_delta_count[GARBAGE_COLLECTION_RESCANS]+"]");
printstream.println("-------------------------------------" +
"-------------------------------------" +
"-----\n");
|
public synchronized long | start(java.lang.String testname)Starts the performance monitor timer and system measurements.
this.init();
m_testname = testname;
for (int i = 0; i < TOTAL_SYSTEM_PERFMON_COUNTERS; i++) {
m_start_count[i] = getStat(i);
}
m_start_t = System.currentTimeMillis();
return (m_start_t);
|
static native int | sysGetCounter(int count)All native methods are defined here
NOTE: functions defined in $(MIDP_WS)/src/share/native/perfmon.c
|
static java.lang.String | toString(java.util.Calendar cal)Formats a Date for output display.
int h = cal.get(Calendar.HOUR);
String hour = h == 0? " (00" : (h < 10? (" (0"+h) : (" ("+h));
int m = cal.get(Calendar.MINUTE);
String min = m == 0? ":00" : (m < 10? (":0"+m) : (":"+m));
int am_pm = cal.get(Calendar.AM_PM);
return cal.toString()+hour+min+" " +
(am_pm == Calendar.PM? "pm)" : "am)");
|