mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
dashboard command print current timestamp. #1595
This commit is contained in:
@@ -13,6 +13,7 @@ public class RuntimeInfoVO {
|
||||
private double systemLoadAverage;
|
||||
private int processors;
|
||||
private long uptime;
|
||||
private long timestamp;
|
||||
|
||||
public RuntimeInfoVO() {
|
||||
}
|
||||
@@ -72,4 +73,12 @@ public class RuntimeInfoVO {
|
||||
public void setUptime(long uptime) {
|
||||
this.uptime = uptime;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.lang.management.MemoryPoolMXBean;
|
||||
import java.lang.management.MemoryType;
|
||||
import java.lang.management.MemoryUsage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -206,6 +207,7 @@ public class DashboardCommand extends AnnotatedCommand {
|
||||
runtimeInfo.setSystemLoadAverage(ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage());
|
||||
runtimeInfo.setProcessors(Runtime.getRuntime().availableProcessors());
|
||||
runtimeInfo.setUptime(ManagementFactory.getRuntimeMXBean().getUptime() / 1000);
|
||||
runtimeInfo.setTimestamp(new Date().getTime());
|
||||
dashboardModel.setRuntimeInfo(runtimeInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.taobao.text.ui.TableElement;
|
||||
import com.taobao.text.util.RenderUtil;
|
||||
|
||||
import java.lang.management.MemoryUsage;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -155,7 +156,7 @@ public class DashboardView extends ResultView<DashboardModel> {
|
||||
table.row("java.home", runtimeInfo.getJavaHome());
|
||||
table.row("systemload.average", String.format("%.2f", runtimeInfo.getSystemLoadAverage()));
|
||||
table.row("processors", "" + runtimeInfo.getProcessors());
|
||||
table.row("uptime", "" + runtimeInfo.getUptime() + "s");
|
||||
table.row("timestamp/uptime", new Date(runtimeInfo.getTimestamp()).toString() + "/" + runtimeInfo.getUptime() + "s");
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user