Methods Summary |
---|
public void | addData(TimeData td)Add a data point.
td.recordMemUsage();
Vector v = (Vector) data.get(td.name);
if (v == null) {
v = new Vector();
data.put(td.name, v);
}
v.add(td.clone());
|
public void | endRun()Mark the ending time of this test run.
end = System.currentTimeMillis();
|
public java.util.LinkedHashMap | getData()
return data;
|
public long | getEnd()
return end;
|
public java.lang.String | getId()
return id;
|
public java.util.Collection | getLabels()Get a list of all available types of data points.
return data.keySet();
|
public MemUsage | getMemUsage(java.lang.String label)Get memory usage stats. for a given data type.
Vector v = (Vector) data.get(label);
if (v == null)
{
return null;
}
MemUsage res = new MemUsage();
res.minFree = Long.MAX_VALUE;
res.minTotal = Long.MAX_VALUE;
long avgFree = 0L, avgTotal = 0L;
for (int i = 0; i < v.size(); i++) {
TimeData td = (TimeData) v.get(i);
if (res.maxFree < td.freeMem)
{
res.maxFree = td.freeMem;
}
if (res.maxTotal < td.totalMem)
{
res.maxTotal = td.totalMem;
}
if (res.minFree > td.freeMem)
{
res.minFree = td.freeMem;
}
if (res.minTotal > td.totalMem)
{
res.minTotal = td.totalMem;
}
avgFree += td.freeMem;
avgTotal += td.totalMem;
}
res.avgFree = avgFree / v.size();
res.avgTotal = avgTotal / v.size();
return res;
|
public long | getStart()
return start;
|
public TimeData | getTotals(java.lang.String label)Get total values from all data points of a given type.
Vector v = (Vector) data.get(label);
if (v == null)
{
return null;
}
TimeData res = new TimeData("TOTAL " + label);
for (int i = 0; i < v.size(); i++) {
TimeData td = (TimeData) v.get(i);
res.count += td.count;
res.elapsed += td.elapsed;
}
return res;
|
public java.util.Vector | getTotals()Get total values from all data points of all types.
Collection labels = getLabels();
Vector v = new Vector();
Iterator it = labels.iterator();
while (it.hasNext()) {
TimeData td = getTotals((String) it.next());
v.add(td);
}
return v;
|
public void | setId(java.lang.String id)
this.id = id;
|
public void | startRun()Mark the starting time of this test run.
start = System.currentTimeMillis();
|
public java.lang.String | toString()Return a string representation.
StringBuffer sb = new StringBuffer();
Collection labels = getLabels();
Iterator it = labels.iterator();
while (it.hasNext()) {
String label = (String) it.next();
sb.append(id).append("-").append(label).append(" ").append(getTotals(label).toString(false)).append(" ");
sb.append(getMemUsage(label).toScaledString(1024 * 1024, "MB")).append("\n");
}
return sb.toString();
|