ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [07/15] ignite git commit: Results printout for IO latency test
Date Wed, 17 May 2017 22:24:04 GMT
Results printout for IO latency test


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a0fc6ee6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a0fc6ee6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a0fc6ee6

Branch: refs/heads/ignite-5075
Commit: a0fc6ee6018007ed9b358b1766e4998cd0a1e9d2
Parents: 958b08f
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Wed May 17 16:36:27 2017 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Wed May 17 16:36:27 2017 +0300

----------------------------------------------------------------------
 .../managers/communication/GridIoManager.java   | 68 +++++++++++++++-----
 1 file changed, 52 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a0fc6ee6/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index fc94667..800f3cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -524,7 +524,9 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
                             Thread.sleep(sleepDuration);
                         }
 
-                        // At this point all threads have finished the test and stored data
to the result map.
+                        // At this point all threads have finished the test and
+                        // stored data to the resulting array of maps.
+                        // Need to iterate it over and sum values for all threads.
                         Map<UUID, long[]> res0 = new HashMap<>();
 
                         for (Map<UUID, long[]> r : res) {
@@ -540,21 +542,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
                             }
                         }
 
-                        StringBuilder b = new StringBuilder("IO test results " +
-                            "[range=" + (maxLatency / (1000 * rangesCnt)) + "mcs]");
-
-                        b.append(U.nl());
-
-                        for (Entry<UUID, long[]> e : res0.entrySet()) {
-                            ClusterNode node = ctx.discovery().node(e.getKey());
-
-                            b.append("    ").append(e.getKey()).append(" (addrs=")
-                                .append(node != null ? node.addresses().toString() : "n/a").append(')')
-                                .append(Arrays.toString(e.getValue())).append(U.nl());
-                        }
-
-                        if (log.isInfoEnabled())
-                            log.info(b.toString());
+                        printIoTestResults(maxLatency / (1000 * rangesCnt), res0);
                     }
                     catch (InterruptedException | BrokenBarrierException e) {
                         U.error(log, "IO test failed.", e);
@@ -637,6 +625,54 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
         }
     }
 
+    /**
+     * @param binLatencyMcs Bin latency in microseconds.
+     * @param res Resulting map.
+     */
+    private void printIoTestResults(long binLatencyMcs, Map<UUID, long[]> res) {
+        StringBuilder b = new StringBuilder(U.nl())
+            .append("IO test results (round-trip count per each latency bin) " +
+                "[binLatency=" + binLatencyMcs + "mcs]")
+            .append(U.nl());
+
+        for (Entry<UUID, long[]> e : res.entrySet()) {
+            ClusterNode node = ctx.discovery().node(e.getKey());
+
+            b.append("Node ID: ").append(e.getKey()).append(" (addrs=")
+                .append(node != null ? node.addresses().toString() : "n/a").append(')').append(U.nl());
+
+            b.append("Latency bin, mcs | Count exclusive | Percentage exclusive | " +
+                "Count inclusive | Percentage inclusive ").append(U.nl());
+
+            long[] nodeRes = e.getValue();
+
+            long sum = 0;
+
+            for (int i = 0; i < nodeRes.length; i++)
+                sum += nodeRes[i];
+
+            long curSum = 0;
+
+            for (int i = 0; i < nodeRes.length; i++) {
+                curSum += nodeRes[i];
+
+                if (i < nodeRes.length - 1)
+                    b.append(String.format("<%11d mcs | %15d | %19.6f%% | %15d | %19.6f%%\n",
+                        (i + 1) * binLatencyMcs,
+                        nodeRes[i], (100.0 * nodeRes[i]) / sum,
+                        curSum, (100.0 * curSum) / sum));
+                else
+                    b.append(String.format(">%11d mcs | %15d | %19.6f%% | %15d | %19.6f%%\n",
+                        i * binLatencyMcs,
+                        nodeRes[i], (100.0 * nodeRes[i]) / sum,
+                        curSum, (100.0 * curSum) / sum));
+            }
+        }
+
+        if (log.isInfoEnabled())
+            log.info(b.toString());
+    }
+
     /** {@inheritDoc} */
     @SuppressWarnings({"deprecation", "SynchronizationOnLocalVariableOrMethodParameter"})
     @Override public void onKernalStart0() throws IgniteCheckedException {


Mime
View raw message