return m_reportManager.getHourlyReport(getStartTime(), domain, true);
}
private Period getHeartBeatInfo(Heartbeat heartbeat, long timestamp) {
String xml = (String) heartbeat.getData();
StatusInfo info = null;
try {
info = com.dianping.cat.status.model.transform.DefaultSaxParser.parse(xml);
} catch (Exception e) {
m_logger.error(xml);
m_logger.error(e.getMessage(), e);
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(timestamp);
int minute = cal.get(Calendar.MINUTE);
Period period = new Period(minute);
try {
ThreadsInfo thread = info.getThread();
period.setThreadCount(thread.getCount());
period.setDaemonCount(thread.getDaemonCount());
period.setTotalStartedCount(thread.getTotalStartedCount());
period.setCatThreadCount(thread.getCatThreadCount());
period.setPigeonThreadCount(thread.getPigeonThreadCount());
period.setHttpThreadCount(thread.getHttpThreadCount());
MessageInfo catInfo = info.getMessage();
period.setCatMessageProduced(catInfo.getProduced());
period.setCatMessageOverflow(catInfo.getOverflowed());
period.setCatMessageSize(catInfo.getBytes());
MemoryInfo memeryInfo = info.getMemory();
List<GcInfo> gcs = info.getMemory().getGcs();
for (GcInfo gc : gcs) {
String name = gc.getName();
if ("ParNew".equals(name) || "PS Scavenge".equals(name)) {
period.setNewGcCount(gc.getCount());
} else if ("ConcurrentMarkSweep".equals(name) || "PS MarkSweep".equals(name)) {
period.setOldGcCount(gc.getCount());
}
}
period.setHeapUsage(memeryInfo.getHeapUsage());
period.setNoneHeapUsage(memeryInfo.getNonHeapUsage());
period.setMemoryFree(memeryInfo.getFree());
period.setSystemLoadAverage(info.getOs().getSystemLoadAverage());
DiskInfo diskInfo = info.getDisk();
if (diskInfo != null) {
for (DiskVolumeInfo volumeInfo : diskInfo.getDiskVolumes()) {
Disk disk = new Disk(volumeInfo.getId());
disk.setTotal(volumeInfo.getTotal());
disk.setFree(volumeInfo.getFree());
disk.setUsable(volumeInfo.getUsable());
period.addDisk(disk);
}
}
for (Entry<String, Extension> entry : info.getExtensions().entrySet()) {
String id = entry.getKey();
Extension ext = entry.getValue();
com.dianping.cat.consumer.heartbeat.model.entity.Extension extension = period.findOrCreateExtension(id);
for (Entry<String, String> kv : ext.getDynamicAttributes().entrySet()) {