PerfMetricId[] pmis = perfMgr.queryAvailablePerfMetric(
vm, null, null, perfInterval);
Calendar curTime = si.currentTime();
PerfQuerySpec qSpec = new PerfQuerySpec();
qSpec.setEntity(vm.getRuntime().getHost());
//metricIDs must be provided, or InvalidArgumentFault
qSpec.setMetricId(pmis);
qSpec.setFormat("normal"); //optional since it's default
qSpec.setIntervalId(perfInterval);
Calendar startTime = (Calendar) curTime.clone();
startTime.roll(Calendar.DATE, -4);
System.out.println("start:" + startTime.getTime());
qSpec.setStartTime(startTime);
Calendar endTime = (Calendar) curTime.clone();
endTime.roll(Calendar.DATE, -3);
System.out.println("end:" + endTime.getTime());
qSpec.setEndTime(endTime);
PerfCompositeMetric pv = perfMgr.queryPerfComposite(qSpec);
if(pv != null)
{
printPerfMetric(pv.getEntity());