[jboss-cvs] JBoss Profiler SVN: r493 - in branches/JBossProfiler2: src/main/org/jboss/profiler/client and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 29 16:33:48 EDT 2008
Author: jesper.pedersen
Date: 2008-10-29 16:33:48 -0400 (Wed, 29 Oct 2008)
New Revision: 493
Modified:
branches/JBossProfiler2/doc/README.txt
branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java
Log:
Add wait time report
Modified: branches/JBossProfiler2/doc/README.txt
===================================================================
--- branches/JBossProfiler2/doc/README.txt 2008-10-29 14:15:55 UTC (rev 492)
+++ branches/JBossProfiler2/doc/README.txt 2008-10-29 20:33:48 UTC (rev 493)
@@ -22,6 +22,7 @@
x Methods
x Hotspots
x Caller
+ x Wait time
x PerThread
x PerClass
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java 2008-10-29 14:15:55 UTC (rev 492)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java 2008-10-29 20:33:48 UTC (rev 493)
@@ -213,6 +213,7 @@
dumpPackages(info, directory);
dumpClasses(classes, info, snapshot.getAllocations(), directory);
dumpCaller(snapshot.getThreads(), directory);
+ dumpWaitTime(classes, directory);
}
}
@@ -849,6 +850,45 @@
}
/**
+ * Dump the wait time to a file writer
+ * @param classes The classes
+ * @param directory The directory
+ * @exception Exception If an error occurs
+ */
+ protected void dumpWaitTime(List<TimedClassInfo> classes,
+ String directory) throws Exception {
+ Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
+
+ DecimalFormat df = new DecimalFormat("#0.00");
+
+ FileWriter fw = new FileWriter(directory + "waittime.txt");
+ BufferedWriter bw = new BufferedWriter(fw, 8192);
+
+ bw.write("Classes:" + NEW_LINE);
+ bw.write("--------" + NEW_LINE);
+
+ int count = 0;
+
+ for (TimedClassInfo tci: classes) {
+ if (tci.getWaitTime() >= threshold) {
+ bw.write(Util.getPrettyName(tci) + "\t");
+ bw.write(Util.getDescription(tci) + "\t");
+ bw.write(df.format(tci.getWaitTime()) + " ms" + NEW_LINE);
+ } else {
+ count++;
+ }
+ }
+
+ if (count > 0) {
+ bw.write(NEW_LINE);
+ bw.write(count + " classes below threshold." + NEW_LINE);
+ }
+
+ bw.flush();
+ bw.close();
+ }
+
+ /**
* Get caller information
* @param fi The frame
* @param data The data
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java 2008-10-29 14:15:55 UTC (rev 492)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/TimedClassComparator.java 2008-10-29 20:33:48 UTC (rev 493)
@@ -36,6 +36,9 @@
/** Method: NAME */
public static final int NAME = 1;
+ /** Method: WAIT TIME */
+ public static final int WAIT_TIME = 2;
+
/** The method */
private int method;
@@ -62,8 +65,17 @@
} else {
return -1;
}
- } else {
+ } else if (method == NAME) {
return ta.getClassName().compareTo(tb.getClassName());
+ } else if (method == WAIT_TIME) {
+ if (ta.getWaitTime() < tb.getWaitTime()) {
+ return 1;
+ } else if (ta.getWaitTime() == tb.getWaitTime()) {
+ return ta.getClassName().compareTo(tb.getClassName());
+ } else {
+ return -1;
+ }
}
+ return 0;
}
}
More information about the jboss-cvs-commits
mailing list