提交 a0c3f64a 编写于 作者: Y You Yong

modify the cat

上级 f8446e16
package com.dianping.cat.report.page.heartbeat;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import junit.framework.Assert;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.dianping.cat.hadoop.dal.Graph;
import com.site.helper.Files;
import com.site.lookup.ComponentTestCase;
@RunWith(JUnit4.class)
......@@ -16,19 +20,50 @@ public class HeartbeatGraphTest extends ComponentTestCase {
@Test
public void test() throws Exception {
Handler handler = new Handler();
long time = System.currentTimeMillis();
time = time - time % (3600 * 1000 * 24);
Date start = new Date(time - 3600 * 1000 * 24);
Date end = new Date(time);
handler.getHeartBeatData(creatModel(), creatPayload());
}
List<Graph> graphs = new ArrayList<Graph>();
time = start.getTime();
for (; time < end.getTime(); time += 3600 * 1000) {
Date addtime = new Date(time);
graphs.add(creatGraph(addtime));
}
Map<String, double[]> result = handler.buildHeartbeatDates(start, end, graphs);
System.out.println(result.size());
for (Entry<String, double[]> entry : result.entrySet()) {
System.out.print(entry.getKey() + " : ");
double sum = 0;
double[] value = entry.getValue();
for (int i = 0; i < value.length; i++) {
sum += value[i];
System.out.print(value[i] + " ");
}
System.out.println();
if (sum != 14400 && sum != 0) {
sum = sum * 1024 * 1024;
}
private Model creatModel() {
return null;
System.out.println("sum:" + sum);
}
}
private Payload creatPayload() {
return null;
private Graph creatGraph(Date start) throws IOException {
Graph graph = new Graph();
graph.setCreationDate(start);
graph.setDomain("Test");
graph.setEndDate(new Date(start.getTime() + 3600 * 1000));
graph.setIp("192.168.32.68");
graph.setName("heartbeat");
graph.setPeriod(start);
graph.setDetailContent(getContent());
return graph;
}
private Graph creatGraph(Date start) {
return null;
private String getContent() throws IOException {
return Files.forIO().readFrom(getClass().getResourceAsStream("detail"), "utf-8");
}
}
ActiveThread 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
CatMessageOverflow 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
CatMessageProduced 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
CatMessageSize 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
CatThreadCount 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
DaemonThread 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
Disk / 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
Disk /data 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
HeapUsage 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
MemoryFree 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
NewGcCount 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
NoneHeapUsage 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
OldGcCount 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
PigeonStartedThread 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
SystemLoadAverage 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
TotalStartedThread 10 10 10 10 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册