cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [1/3] cassandra git commit: include missing files
Date Tue, 10 Mar 2015 17:14:08 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 6bbfb5574 -> 97d65d6d3
  refs/heads/trunk b7563f823 -> 05a6f2667


include missing files


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

Branch: refs/heads/cassandra-2.1
Commit: 97d65d6d3689ef3fd47d760004377486ad00d631
Parents: 6bbfb55
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Tue Mar 10 17:13:46 2015 +0000
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Tue Mar 10 17:13:46 2015 +0000

----------------------------------------------------------------------
 .../cassandra/stress/util/TimingIntervals.java  | 139 +++++++++++++++++++
 1 file changed, 139 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/97d65d6d/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
new file mode 100644
index 0000000..ab89d07
--- /dev/null
+++ b/tools/stress/src/org/apache/cassandra/stress/util/TimingIntervals.java
@@ -0,0 +1,139 @@
+package org.apache.cassandra.stress.util;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class TimingIntervals
+{
+    final Map<String, TimingInterval> intervals;
+    TimingIntervals(Iterable<String> opTypes)
+    {
+        long now = System.nanoTime();
+        intervals = new TreeMap<>();
+        for (String opType : opTypes)
+            intervals.put(opType, new TimingInterval(now));
+    }
+
+    TimingIntervals(Map<String, TimingInterval> intervals)
+    {
+        this.intervals = intervals;
+    }
+
+    public TimingIntervals merge(TimingIntervals with, int maxSamples, long start)
+    {
+        assert intervals.size() == with.intervals.size();
+        TreeMap<String, TimingInterval> ret = new TreeMap<>();
+
+        for (String opType : intervals.keySet())
+        {
+            assert with.intervals.containsKey(opType);
+            ret.put(opType, TimingInterval.merge(Arrays.asList(intervals.get(opType), with.intervals.get(opType)),
maxSamples, start));
+        }
+
+        return new TimingIntervals(ret);
+    }
+
+    public TimingInterval get(String opType)
+    {
+        return intervals.get(opType);
+    }
+
+    public TimingInterval combine(int maxSamples)
+    {
+        long start = Long.MAX_VALUE;
+        for (TimingInterval ti : intervals.values())
+            start = Math.min(start, ti.startNanos());
+
+        return TimingInterval.merge(intervals.values(), maxSamples, start);
+    }
+
+    public String str(TimingInterval.TimingParameter value)
+    {
+        return str(value, Float.NaN);
+    }
+
+    public String str(TimingInterval.TimingParameter value, float rank)
+    {
+        StringBuilder sb = new StringBuilder("[");
+
+        for (Map.Entry<String, TimingInterval> entry : intervals.entrySet())
+        {
+            sb.append(entry.getKey());
+            sb.append(":");
+            sb.append(entry.getValue().getStringValue(value, rank));
+            sb.append(", ");
+        }
+
+        sb.setLength(sb.length()-2);
+        sb.append("]");
+
+        return sb.toString();
+    }
+
+    public String opRates()
+    {
+        return str(TimingInterval.TimingParameter.OPRATE);
+    }
+    public String partitionRates()
+    {
+        return str(TimingInterval.TimingParameter.PARTITIONRATE);
+    }
+    public String rowRates()
+    {
+        return str(TimingInterval.TimingParameter.ROWRATE);
+    }
+    public String meanLatencies()
+    {
+        return str(TimingInterval.TimingParameter.MEANLATENCY);
+    }
+    public String maxLatencies()
+    {
+        return str(TimingInterval.TimingParameter.MAXLATENCY);
+    }
+    public String medianLatencies()
+    {
+        return str(TimingInterval.TimingParameter.MEDIANLATENCY);
+    }
+    public String rankLatencies(float rank)
+    {
+        return str(TimingInterval.TimingParameter.MEDIANLATENCY, rank);
+    }
+    public String errorCounts()
+    {
+        return str(TimingInterval.TimingParameter.ERRORCOUNT);
+    }
+    public String partitionCounts()
+    {
+        return str(TimingInterval.TimingParameter.PARTITIONCOUNT);
+    }
+
+    public long opRate()
+    {
+        long v = 0;
+        for (TimingInterval interval : intervals.values())
+            v += interval.opRate();
+        return v;
+    }
+
+    public long startNanos()
+    {
+        long start = Long.MAX_VALUE;
+        for (TimingInterval interval : intervals.values())
+            start = Math.min(start, interval.startNanos());
+        return start;
+    }
+
+    public long endNanos()
+    {
+        long end = Long.MIN_VALUE;
+        for (TimingInterval interval : intervals.values())
+            end = Math.max(end, interval.startNanos());
+        return end;
+    }
+
+    public Map<String, TimingInterval> intervals()
+    {
+        return intervals;
+    }
+}


Mime
View raw message