commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1508084 - in /commons/sandbox/monitoring/trunk: core/src/main/java/org/apache/commons/monitoring/monitors/ core/src/test/java/org/apache/commons/monitoring/stopwatches/ reporting/src/main/java/org/apache/commons/monitoring/reporting/format...
Date Mon, 29 Jul 2013 14:42:35 GMT
Author: rmannibucau
Date: Mon Jul 29 14:42:35 2013
New Revision: 1508084

URL: http://svn.apache.org/r1508084
Log:
adding concurrency (and not only maxConcurrency)

Modified:
    commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/DefaultMonitor.java
    commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/Monitor.java
    commons/sandbox/monitoring/trunk/core/src/test/java/org/apache/commons/monitoring/stopwatches/DefaultStopWatchTest.java
    commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/format/MetricData.java
    commons/sandbox/monitoring/trunk/reporting/src/test/java/org/apache/commons/monitoring/reporting/FormatsTest.java

Modified: commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/DefaultMonitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/DefaultMonitor.java?rev=1508084&r1=1508083&r2=1508084&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/DefaultMonitor.java
(original)
+++ commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/DefaultMonitor.java
Mon Jul 29 14:42:35 2013
@@ -110,4 +110,9 @@ public class DefaultMonitor implements M
     public int getMaxConcurrency() {
         return maxConcurrency;
     }
+
+    @Override
+    public int getConcurrency() {
+        return currentConcurrency().get();
+    }
 }

Modified: commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/Monitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/Monitor.java?rev=1508084&r1=1508083&r2=1508084&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/Monitor.java
(original)
+++ commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/monitors/Monitor.java
Mon Jul 29 14:42:35 2013
@@ -87,6 +87,7 @@ public interface Monitor {
     void updateConcurrency(int concurrency);
 
     int getMaxConcurrency();
+    int getConcurrency();
 
     /**
      * Identifier class for Monitors.

Modified: commons/sandbox/monitoring/trunk/core/src/test/java/org/apache/commons/monitoring/stopwatches/DefaultStopWatchTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/core/src/test/java/org/apache/commons/monitoring/stopwatches/DefaultStopWatchTest.java?rev=1508084&r1=1508083&r2=1508084&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/core/src/test/java/org/apache/commons/monitoring/stopwatches/DefaultStopWatchTest.java
(original)
+++ commons/sandbox/monitoring/trunk/core/src/test/java/org/apache/commons/monitoring/stopwatches/DefaultStopWatchTest.java
Mon Jul 29 14:42:35 2013
@@ -188,5 +188,10 @@ public class DefaultStopWatchTest {
         public int getMaxConcurrency() {
             return 0;
         }
+
+        @Override
+        public int getConcurrency() {
+            return 0;
+        }
     }
 }

Modified: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/format/MetricData.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/format/MetricData.java?rev=1508084&r1=1508083&r2=1508084&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/format/MetricData.java
(original)
+++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/format/MetricData.java
Mon Jul 29 14:42:35 2013
@@ -155,6 +155,17 @@ public enum MetricData {
             return true;
         }
     },
+    Concurrency {
+        @Override
+        public double value(final Counter counter) {
+            return counter.getMonitor().getConcurrency();
+        }
+
+        @Override
+        public boolean isTime() {
+            return false;
+        }
+    },
     MaxConcurrency {
         @Override
         public double value(final Counter counter) {

Modified: commons/sandbox/monitoring/trunk/reporting/src/test/java/org/apache/commons/monitoring/reporting/FormatsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/test/java/org/apache/commons/monitoring/reporting/FormatsTest.java?rev=1508084&r1=1508083&r2=1508084&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/reporting/src/test/java/org/apache/commons/monitoring/reporting/FormatsTest.java
(original)
+++ commons/sandbox/monitoring/trunk/reporting/src/test/java/org/apache/commons/monitoring/reporting/FormatsTest.java
Mon Jul 29 14:42:35 2013
@@ -55,7 +55,7 @@ public class FormatsTest {
         assertEquals("<repository>" +
             "<monitor name=\"RendererTest\" category=\"unit\">" +
             "<counter role=\"failures\" unit=\"u\" Hits=\"1.0\" Max=\"1.0\" Mean=\"1.0\"
Min=\"1.0\" StandardDeviation=\"0.0\" Sum=\"1.0\" " +
-            "SumOfLogs=\"0.0\" SumOfSquares=\"0.0\" Variance=\"0.0\" GeometricMean=\"1.0\"
Value=\"1.0\" MaxConcurrency=\"1.0\" />" +
+            "SumOfLogs=\"0.0\" SumOfSquares=\"0.0\" Variance=\"0.0\" GeometricMean=\"1.0\"
Value=\"1.0\" Concurrency=\"0.0\" MaxConcurrency=\"1.0\" />" +
             "</monitor>" +
             "</repository>".trim(), out.toString());
     }
@@ -69,7 +69,7 @@ public class FormatsTest {
             "{\"name\":\"RendererTest\",\"category\":\"unit\",\"counters\":[" +
             "{\"role\":\"failures\",\"unit\":\"u\",\"Hits\":\"1.0\",\"Max\":\"1.0\",\"Mean\":\"1.0\",\"Min\":\"1.0\","
+
             "\"StandardDeviation\":\"0.0\",\"Sum\":\"1.0\",\"SumOfLogs\":\"0.0\",\"SumOfSquares\":\"0.0\",\"Variance\":\"0.0\","
+
-            "\"GeometricMean\":\"1.0\",\"Value\":\"1.0\",\"MaxConcurrency\":\"1.0\"}]}]}",
out.toString());
+            "\"GeometricMean\":\"1.0\",\"Value\":\"1.0\",\"Concurrency\":\"0.0\",\"MaxConcurrency\":\"1.0\"}]}]}",
out.toString());
     }
 
     @Test
@@ -78,7 +78,7 @@ public class FormatsTest {
         Format.Defaults.CSV.render(new PrintWriter(out), Collections.<String, Object>emptyMap());
 
         assertEquals(CSVFormat.HEADER +
-            "RendererTest;unit;failures (u);1.0;1.0;1.0;1.0;0.0;1.0;0.0;0.0;0.0;1.0;1.0;1.0\n",
+            "RendererTest;unit;failures (u);1.0;1.0;1.0;1.0;0.0;1.0;0.0;0.0;0.0;1.0;1.0;0.0;1.0\n",
             out.toString());
     }
 }



Mime
View raw message