diff --git a/core/src/main/java/com/taobao/arthas/core/command/monitor200/MonitorAdviceListener.java b/core/src/main/java/com/taobao/arthas/core/command/monitor200/MonitorAdviceListener.java index 53ab5e5742f..fe01b212ebe 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/monitor200/MonitorAdviceListener.java +++ b/core/src/main/java/com/taobao/arthas/core/command/monitor200/MonitorAdviceListener.java @@ -94,7 +94,7 @@ public synchronized void create() { if (timer == null) { timer = new Timer("Timer-for-arthas-monitor-" + process.session().getSessionId(), true); timer.scheduleAtFixedRate(new MonitorTimer(monitorData, process, command.getNumberOfLimit()), - 0, command.getCycle() * 1000); + 0, command.getCycle() * 1000L); } } diff --git a/core/src/main/java/com/taobao/arthas/core/command/monitor200/ThreadSampler.java b/core/src/main/java/com/taobao/arthas/core/command/monitor200/ThreadSampler.java index da414d00f06..91fade566d3 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/monitor200/ThreadSampler.java +++ b/core/src/main/java/com/taobao/arthas/core/command/monitor200/ThreadSampler.java @@ -118,7 +118,7 @@ public int compare(ThreadVO o1, ThreadVO o2) { // Compute cpu usage final HashMap cpuUsages = new HashMap(threads.size()); for (ThreadVO thread : threads) { - double cpu = sampleIntervalNanos == 0 ? 0 : (deltas.get(thread) * 10000 / sampleIntervalNanos / 100.0); + double cpu = sampleIntervalNanos == 0 ? 0 : (Math.rint(deltas.get(thread) * 10000.0 / sampleIntervalNanos) / 100.0); cpuUsages.put(thread, cpu); }