cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject cassandra git commit: Add units to stress output
Date Fri, 29 Apr 2016 16:01:54 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 99f0ff938 -> ff4d0f9ab


Add units to stress output

Patch by Giampaolo Trapasso; reviewed by Tyler Hobbs for CASSANDRA-11352


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

Branch: refs/heads/trunk
Commit: ff4d0f9abe79ef0925c150d92e6123650e07629b
Parents: 99f0ff9
Author: Giampaolo Trapasso <giampaolo.trapasso@radicalbit.io>
Authored: Thu Apr 28 15:54:00 2016 -0500
Committer: Tyler Hobbs <tylerlhobbs@gmail.com>
Committed: Fri Apr 29 11:01:24 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/utils/FBUtilities.java | 11 ++++--
 .../apache/cassandra/stress/StressMetrics.java  | 33 +++++++++--------
 .../cassandra/stress/util/TimingInterval.java   | 20 +++++-----
 .../cassandra/stress/util/TimingIntervals.java  | 39 +++++++++++++-------
 5 files changed, 62 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff4d0f9a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e11ebd8..8ee39dc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.6
+ * Add units to stress ouput (CASSANDRA-11352)
  * Fix PER PARTITION LIMIT for single and multi partitions queries (CASSANDRA-11603)
  * Add uncompressed chunk cache for RandomAccessReader (CASSANDRA-5863)
  * Clarify ClusteringPrefix hierarchy (CASSANDRA-11213)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff4d0f9a/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index f8c82c3..76178ad 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -588,11 +588,16 @@ public class FBUtilities
 
     public static String prettyPrintMemory(long size)
     {
+        return prettyPrintMemory(size, false);
+    }
+
+    public static String prettyPrintMemory(long size, boolean includeSpace)
+    {
         if (size >= 1 << 30)
-            return String.format("%.3fGiB", size / (double) (1 << 30));
+            return String.format("%.3f%sGiB", size / (double) (1 << 30), includeSpace
? " " : "");
         if (size >= 1 << 20)
-            return String.format("%.3fMiB", size / (double) (1 << 20));
-        return String.format("%.3fKiB", size / (double) (1 << 10));
+            return String.format("%.3f%sMiB", size / (double) (1 << 20), includeSpace
? " " : "");
+        return String.format("%.3f%sKiB", size / (double) (1 << 10), includeSpace ?
" " : "");
     }
 
     public static String prettyPrintMemoryPerSecond(long rate)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff4d0f9a/tools/stress/src/org/apache/cassandra/stress/StressMetrics.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/StressMetrics.java b/tools/stress/src/org/apache/cassandra/stress/StressMetrics.java
index 3585a00..fa36716 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressMetrics.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressMetrics.java
@@ -33,6 +33,7 @@ import org.apache.cassandra.stress.util.*;
 import org.apache.commons.lang3.time.DurationFormatUtils;
 import org.apache.cassandra.concurrent.NamedThreadFactory;
 import org.apache.cassandra.stress.settings.StressSettings;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class StressMetrics
 {
@@ -217,22 +218,22 @@ public class StressMetrics
 
         TimingIntervals opHistory = timing.getHistory();
         TimingInterval history = opHistory.combine(settings.samples.historyCount);
-        output.println(String.format("op rate                   : %.0f %s", history.opRate(),
opHistory.opRates()));
-        output.println(String.format("partition rate            : %.0f %s", history.partitionRate(),
opHistory.partitionRates()));
-        output.println(String.format("row rate                  : %.0f %s", history.rowRate(),
opHistory.rowRates()));
-        output.println(String.format("latency mean              : %.1f %s", history.meanLatency(),
opHistory.meanLatencies()));
-        output.println(String.format("latency median            : %.1f %s", history.medianLatency(),
opHistory.medianLatencies()));
-        output.println(String.format("latency 95th percentile   : %.1f %s", history.rankLatency(.95f),
opHistory.rankLatencies(0.95f)));
-        output.println(String.format("latency 99th percentile   : %.1f %s", history.rankLatency(0.99f),
opHistory.rankLatencies(0.99f)));
-        output.println(String.format("latency 99.9th percentile : %.1f %s", history.rankLatency(0.999f),
opHistory.rankLatencies(0.999f)));
-        output.println(String.format("latency max               : %.1f %s", history.maxLatency(),
opHistory.maxLatencies()));
-        output.println(String.format("Total partitions          : %d %s",   history.partitionCount,
opHistory.partitionCounts()));
-        output.println(String.format("Total errors              : %d %s",   history.errorCount,
opHistory.errorCounts()));
-        output.println(String.format("total gc count            : %.0f", totalGcStats.count));
-        output.println(String.format("total gc mb               : %.0f", totalGcStats.bytes
/ (1 << 20)));
-        output.println(String.format("total gc time (s)         : %.0f", totalGcStats.summs
/ 1000));
-        output.println(String.format("avg gc time(ms)           : %.0f", totalGcStats.summs
/ totalGcStats.count));
-        output.println(String.format("stdev gc time(ms)         : %.0f", totalGcStats.sdvms));
+        output.println(String.format("Op rate                   : %,8.0f op/s  %s", history.opRate(),
opHistory.opRates()));
+        output.println(String.format("Partition rate            : %,8.0f pk/s  %s", history.partitionRate(),
opHistory.partitionRates()));
+        output.println(String.format("Row rate                  : %,8.0f row/s %s", history.rowRate(),
opHistory.rowRates()));
+        output.println(String.format("Latency mean              : %6.1f ms %s", history.meanLatency(),
opHistory.meanLatencies()));
+        output.println(String.format("Latency median            : %6.1f ms %s", history.medianLatency(),
opHistory.medianLatencies()));
+        output.println(String.format("Latency 95th percentile   : %6.1f ms %s", history.rankLatency(.95f),
opHistory.rankLatencies(0.95f)));
+        output.println(String.format("Latency 99th percentile   : %6.1f ms %s", history.rankLatency(0.99f),
opHistory.rankLatencies(0.99f)));
+        output.println(String.format("Latency 99.9th percentile : %6.1f ms %s", history.rankLatency(0.999f),
opHistory.rankLatencies(0.999f)));
+        output.println(String.format("Latency max               : %6.1f ms %s", history.maxLatency(),
opHistory.maxLatencies()));
+        output.println(String.format("Total partitions          : %,10d %s",   history.partitionCount,
opHistory.partitionCounts()));
+        output.println(String.format("Total errors              : %,10d %s",   history.errorCount,
opHistory.errorCounts()));
+        output.println(String.format("Total GC count            : %,1.0f", totalGcStats.count));
+        output.println(String.format("Total GC memory           : %s", FBUtilities.prettyPrintMemory((long)totalGcStats.bytes,
true)));
+        output.println(String.format("Total GC time             : %,6.1f seconds", totalGcStats.summs
/ 1000));
+        output.println(String.format("Avg GC time               : %,6.1f ms", totalGcStats.summs
/ totalGcStats.count));
+        output.println(String.format("StdDev GC time            : %,6.1f ms", totalGcStats.sdvms));
         output.println("Total operation time      : " + DurationFormatUtils.formatDuration(
                 history.runTime(), "HH:mm:ss", true));
         output.println(""); // Newline is important here to separate the aggregates section
from the END or the next stress iteration

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff4d0f9a/tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java b/tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java
index 89995dd..ede235c 100644
--- a/tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java
+++ b/tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java
@@ -186,16 +186,16 @@ public final class TimingInterval
     {
         switch (value)
         {
-            case OPRATE:         return String.format("%.0f", opRate());
-            case ROWRATE:        return String.format("%.0f", rowRate());
-            case ADJROWRATE:     return String.format("%.0f", adjustedRowRate());
-            case PARTITIONRATE:  return String.format("%.0f", partitionRate());
-            case MEANLATENCY:    return String.format("%.1f", meanLatency());
-            case MAXLATENCY:     return String.format("%.1f", maxLatency());
-            case MEDIANLATENCY:  return String.format("%.1f", medianLatency());
-            case RANKLATENCY:    return String.format("%.1f", rankLatency(rank));
-            case ERRORCOUNT:     return String.format("%d", errorCount);
-            case PARTITIONCOUNT: return String.format("%d", partitionCount);
+            case OPRATE:         return String.format("%,.0f", opRate());
+            case ROWRATE:        return String.format("%,.0f", rowRate());
+            case ADJROWRATE:     return String.format("%,.0f", adjustedRowRate());
+            case PARTITIONRATE:  return String.format("%,.0f", partitionRate());
+            case MEANLATENCY:    return String.format("%,.1f", meanLatency());
+            case MAXLATENCY:     return String.format("%,.1f", maxLatency());
+            case MEDIANLATENCY:  return String.format("%,.1f", medianLatency());
+            case RANKLATENCY:    return String.format("%,.1f", rankLatency(rank));
+            case ERRORCOUNT:     return String.format("%,d", errorCount);
+            case PARTITIONCOUNT: return String.format("%,d", partitionCount);
             default:             throw new IllegalStateException();
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff4d0f9a/tools/stress/src/org/apache/cassandra/stress/util/TimingIntervals.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/util/TimingIntervals.java b/tools/stress/src/org/apache/cassandra/stress/util/TimingIntervals.java
index f989173..17680a7 100644
--- a/tools/stress/src/org/apache/cassandra/stress/util/TimingIntervals.java
+++ b/tools/stress/src/org/apache/cassandra/stress/util/TimingIntervals.java
@@ -48,20 +48,25 @@ public class TimingIntervals
         return TimingInterval.merge(intervals.values(), maxSamples, start);
     }
 
-    public String str(TimingInterval.TimingParameter value)
+    public String str(TimingInterval.TimingParameter value, String unit)
     {
-        return str(value, Float.NaN);
+        return str(value, Float.NaN, unit);
     }
 
-    public String str(TimingInterval.TimingParameter value, float rank)
+    public String str(TimingInterval.TimingParameter value, float rank, String unit)
     {
         StringBuilder sb = new StringBuilder("[");
 
         for (Map.Entry<String, TimingInterval> entry : intervals.entrySet())
         {
             sb.append(entry.getKey());
-            sb.append(":");
+            sb.append(": ");
             sb.append(entry.getValue().getStringValue(value, rank));
+            if (unit.length() > 0)
+            {
+                sb.append(" ");
+                sb.append(unit);
+            }
             sb.append(", ");
         }
 
@@ -73,39 +78,47 @@ public class TimingIntervals
 
     public String opRates()
     {
-        return str(TimingInterval.TimingParameter.OPRATE);
+        return str(TimingInterval.TimingParameter.OPRATE, "op/s");
     }
+
     public String partitionRates()
     {
-        return str(TimingInterval.TimingParameter.PARTITIONRATE);
+        return str(TimingInterval.TimingParameter.PARTITIONRATE, "pk/s");
     }
+
     public String rowRates()
     {
-        return str(TimingInterval.TimingParameter.ROWRATE);
+        return str(TimingInterval.TimingParameter.ROWRATE, "row/s");
     }
+
     public String meanLatencies()
     {
-        return str(TimingInterval.TimingParameter.MEANLATENCY);
+        return str(TimingInterval.TimingParameter.MEANLATENCY, "ms");
     }
+
     public String maxLatencies()
     {
-        return str(TimingInterval.TimingParameter.MAXLATENCY);
+        return str(TimingInterval.TimingParameter.MAXLATENCY, "ms");
     }
+
     public String medianLatencies()
     {
-        return str(TimingInterval.TimingParameter.MEDIANLATENCY);
+        return str(TimingInterval.TimingParameter.MEDIANLATENCY, "ms");
     }
+
     public String rankLatencies(float rank)
     {
-        return str(TimingInterval.TimingParameter.RANKLATENCY, rank);
+        return str(TimingInterval.TimingParameter.RANKLATENCY, rank, "ms");
     }
+
     public String errorCounts()
     {
-        return str(TimingInterval.TimingParameter.ERRORCOUNT);
+        return str(TimingInterval.TimingParameter.ERRORCOUNT, "");
     }
+
     public String partitionCounts()
     {
-        return str(TimingInterval.TimingParameter.PARTITIONCOUNT);
+        return str(TimingInterval.TimingParameter.PARTITIONCOUNT, "");
     }
 
     public long opRate()


Mime
View raw message