From da1002957ab512a5200f78d3eed6831f934e23a8 Mon Sep 17 00:00:00 2001 From: "bryan.zhang" Date: Tue, 30 Jan 2018 14:15:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=8E=A7=E5=99=A8=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E9=99=A4=E5=86=85=E5=AD=98=E7=9A=84=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E3=80=82=20=E6=9C=89=E7=82=B9=E9=B8=A1=E8=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../liteflow/core/NodeComponent.java | 1 - .../liteflow/entity/data/AbsSlot.java | 4 +++ .../liteflow/monitor/MonitorBus.java | 28 ++++--------------- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 1e5f5bfa0..36916c72f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ liteflow jar 4.0.0 - 1.2.20-SNAPSHOT + 1.3.0 UTF-8 diff --git a/src/main/java/com/thebeastshop/liteflow/core/NodeComponent.java b/src/main/java/com/thebeastshop/liteflow/core/NodeComponent.java index 612d8d9b5..0f77eb276 100644 --- a/src/main/java/com/thebeastshop/liteflow/core/NodeComponent.java +++ b/src/main/java/com/thebeastshop/liteflow/core/NodeComponent.java @@ -50,7 +50,6 @@ public abstract class NodeComponent { CompStatistics statistics = new CompStatistics(); statistics.setComponentClazzName(this.getClass().getSimpleName()); statistics.setTimeSpent(timeSpent); - statistics.setMemorySpent(initm-endm); MonitorBus.addStatistics(statistics); diff --git a/src/main/java/com/thebeastshop/liteflow/entity/data/AbsSlot.java b/src/main/java/com/thebeastshop/liteflow/entity/data/AbsSlot.java index 3fa11409f..b95c47321 100644 --- a/src/main/java/com/thebeastshop/liteflow/entity/data/AbsSlot.java +++ b/src/main/java/com/thebeastshop/liteflow/entity/data/AbsSlot.java @@ -139,4 +139,8 @@ public abstract class AbsSlot implements Slot{ public String getRequestId() { return (String)dataMap.get(REQUEST_ID); } + + public Deque getExecuteSteps() { + return executeSteps; + } } diff --git a/src/main/java/com/thebeastshop/liteflow/monitor/MonitorBus.java b/src/main/java/com/thebeastshop/liteflow/monitor/MonitorBus.java index 8c4ce7de4..c25973c5a 100644 --- a/src/main/java/com/thebeastshop/liteflow/monitor/MonitorBus.java +++ b/src/main/java/com/thebeastshop/liteflow/monitor/MonitorBus.java @@ -60,34 +60,22 @@ public class MonitorBus { public static void printStatistics(){ try{ - Map compAverageTimeSpent = new HashMap(); - Map compAverageMemorySpent = new HashMap(); + Map compAverageTimeSpent = new HashMap(); long totalTimeSpent = 0; - long totalMemorySpent = 0; for(Entry> entry : statisticsMap.entrySet()){ for(CompStatistics statistics : entry.getValue()){ totalTimeSpent += statistics.getTimeSpent(); - totalMemorySpent += statistics.getMemorySpent(); } - compAverageTimeSpent.put(entry.getKey(), new BigDecimal(totalTimeSpent).divide(new BigDecimal(entry.getValue().size()), 2, RoundingMode.HALF_UP).longValue()); - compAverageMemorySpent.put(entry.getKey(), new BigDecimal(totalMemorySpent).divide(new BigDecimal(entry.getValue().size()), 2, RoundingMode.HALF_UP).longValue()); + compAverageTimeSpent.put(entry.getKey(), new BigDecimal(totalTimeSpent).divide(new BigDecimal(entry.getValue().size()), 2, RoundingMode.HALF_UP)); } - List> compAverageTimeSpentEntryList = new ArrayList<>(compAverageTimeSpent.entrySet()); - List> compAverageMemorySpentEntryList = new ArrayList<>(compAverageMemorySpent.entrySet()); + List> compAverageTimeSpentEntryList = new ArrayList<>(compAverageTimeSpent.entrySet()); - Collections.sort(compAverageTimeSpentEntryList,new Comparator>() { + Collections.sort(compAverageTimeSpentEntryList,new Comparator>() { @Override - public int compare(Entry o1, Entry o2) { - return o2.getValue().compareTo(o1.getValue()); - } - }); - - Collections.sort(compAverageMemorySpentEntryList,new Comparator>() { - @Override - public int compare(Entry o1, Entry o2) { + public int compare(Entry o1, Entry o2) { return o2.getValue().compareTo(o1.getValue()); } }); @@ -99,13 +87,9 @@ public class MonitorBus { logStr.append(MessageFormat.format("SLOT TOTAL SIZE : {0}\n", DataBus.SLOT_SIZE)); logStr.append(MessageFormat.format("SLOT OCCUPY COUNT : {0}\n", DataBus.OCCUPY_COUNT)); logStr.append("===============================TIME AVERAGE SPENT=====================================\n"); - for(Entry entry : compAverageTimeSpentEntryList){ + for(Entry entry : compAverageTimeSpentEntryList){ logStr.append(MessageFormat.format("COMPONENT[{0}] AVERAGE TIME SPENT : {1}\n", entry.getKey(), entry.getValue())); } - logStr.append("==============================MEMORY AVERAGE SPENT====================================\n"); - for(Entry entry : compAverageMemorySpentEntryList){ - logStr.append(MessageFormat.format("COMPONENT[{0}] AVERAGE MEMORY SPENT : {1}K\n", entry.getKey(), new BigDecimal(entry.getValue()).divide(new BigDecimal(1024), 2, RoundingMode.HALF_UP))); - } logStr.append("======================================================================================\n"); LOG.info(logStr.toString()); }catch(Exception e){