refactored the XML output of the performance tests a little to make it XML compliant and to add a client index so its easy to render the XML in tables etc

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@412483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-06-07 18:40:19 +00:00
parent 1ff39dbdec
commit 4b2f479073
3 changed files with 17 additions and 3 deletions

View File

@ -22,14 +22,23 @@ import javax.jms.JMSException;
public class JmsPerformanceSupport extends JmsClientSupport implements PerfMeasurable {
protected AtomicLong throughput = new AtomicLong(0);
private static int clientCounter;
protected AtomicLong throughput = new AtomicLong(0);
protected PerfEventListener listener = null;
private int clientNumber;
public void reset() {
setThroughput(0);
}
public synchronized int getClientNumber() {
if (clientNumber == 0) {
clientNumber = incrementClientCounter();
}
return clientNumber;
}
public String getClientName() {
try {
return getConnection().getClientID();
@ -61,4 +70,8 @@ public class JmsPerformanceSupport extends JmsClientSupport implements PerfMeasu
public PerfEventListener getPerfEventListener() {
return listener;
}
protected static synchronized int incrementClientCounter() {
return ++clientCounter;
}
}

View File

@ -20,6 +20,7 @@ import java.util.Properties;
public interface PerfMeasurable {
public void reset();
public int getClientNumber();
public String getClientName();
public long getThroughput();
public Properties getSettings();

View File

@ -169,8 +169,8 @@ public class PerfMeasurementTool implements PerfEventListener, Runnable {
public void sampleClients() {
for (Iterator i = perfClients.iterator(); i.hasNext();) {
PerfMeasurable client = (PerfMeasurable) i.next();
getWriter().println("<sample index=" + sampleIndex + " name=" + client.getClientName() +
" throughput=" + client.getThroughput() + "/>");
getWriter().println("<sample index='" + sampleIndex + "' clientNumber='" + client.getClientNumber()
+ "' name='" + client.getClientName() + "' throughput='" + client.getThroughput() + "'/>");
client.reset();
}
}