ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject ignite git commit: IGNITE-1071 IgniteCache.metrics() method returns local metrics
Date Fri, 25 Mar 2016 11:36:28 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1071 f9d11cb87 -> 318629835


IGNITE-1071 IgniteCache.metrics() method returns local metrics


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

Branch: refs/heads/ignite-1071
Commit: 318629835eca48aa618b178638fb3476af1f8b34
Parents: f9d11cb
Author: Anton Vinogradov <av@apache.org>
Authored: Fri Mar 25 14:36:15 2016 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Fri Mar 25 14:36:15 2016 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAbstractMetricsSelfTest.java | 104 +++++++++----------
 1 file changed, 52 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/31862983/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index 57610b4..268fcfc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -172,7 +172,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         // Assert that statistics is clear.
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).metrics();
+            CacheMetrics m = grid(i).cache(null).localMetrics();
 
             assertEquals(m.getCacheGets(), 0);
             assertEquals(m.getCachePuts(), 0);
@@ -193,7 +193,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testGetMetricsSnapshot() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
 
-        assertNotSame("Method metrics() should return snapshot.", cache.metrics(), cache.metrics());
+        assertNotSame("Method metrics() should return snapshot.", cache.localMetrics(), cache.localMetrics());
     }
 
     /**
@@ -207,7 +207,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < KEY_CNT; i++)
             cache.put(i, i);
 
-        assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
+        assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
         for (int i = 0; i < KEY_CNT; i++) {
             cacheAsync.getAndRemove(i);
@@ -217,7 +217,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             fut.get();
         }
 
-        assert cache.metrics().getAverageRemoveTime() > 0;
+        assert cache.localMetrics().getAverageRemoveTime() > 0;
     }
 
     /**
@@ -237,7 +237,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             }
         }
 
-        assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
+        assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
         cache.put(key, key);
 
@@ -247,7 +247,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         assertTrue(fut.get());
 
-        assert cache.metrics().getAverageRemoveTime() >= 0;
+        assert cache.localMetrics().getAverageRemoveTime() >= 0;
     }
 
     /**
@@ -259,12 +259,12 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < KEY_CNT; i++)
             cache.put(i, i);
 
-        assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
+        assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
         for (int i = 0; i < KEY_CNT; i++)
             cache.remove(i);
 
-        assert cache.metrics().getAverageRemoveTime() > 0;
+        assert cache.localMetrics().getAverageRemoveTime() > 0;
     }
 
     /**
@@ -277,7 +277,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         cache.put(2, 2);
         cache.put(3, 3);
 
-        assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
+        assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
         Set<Integer> keys = new HashSet<>(4, 1);
         keys.add(1);
@@ -286,7 +286,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.removeAll(keys);
 
-        float averageRemoveTime = cache.metrics().getAverageRemoveTime();
+        float averageRemoveTime = cache.localMetrics().getAverageRemoveTime();
 
         assert averageRemoveTime >= 0;
     }
@@ -311,7 +311,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             }
         }
 
-        assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
+        assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
         cacheAsync.removeAll(keys);
 
@@ -319,7 +319,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         fut.get();
 
-        assert cache.metrics().getAverageRemoveTime() >= 0;
+        assert cache.localMetrics().getAverageRemoveTime() >= 0;
     }
 
 
@@ -331,17 +331,17 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.put(1, 1);
 
-        assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
         cache.get(1);
 
-        float averageGetTime = cache.metrics().getAverageGetTime();
+        float averageGetTime = cache.localMetrics().getAverageGetTime();
 
         assert averageGetTime > 0;
 
         cache.get(2);
 
-        assert cache.metrics().getAverageGetTime() > 0;
+        assert cache.localMetrics().getAverageGetTime() > 0;
     }
 
     /**
@@ -350,13 +350,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testGetAllAvgTime() throws Exception {
         IgniteCache<Integer, Integer> cache = grid(0).cache(null);
 
-        assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
         cache.put(1, 1);
         cache.put(2, 2);
         cache.put(3, 3);
 
-        assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
         Set<Integer> keys = new TreeSet<>();
         keys.add(1);
@@ -365,7 +365,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.getAll(keys);
 
-        assert cache.metrics().getAverageGetTime() > 0;
+        assert cache.localMetrics().getAverageGetTime() > 0;
     }
 
     /**
@@ -375,13 +375,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         IgniteCache<Object, Object> cache = grid(0).cache(null);
         IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
-        assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
         cache.put(1, 1);
         cache.put(2, 2);
         cache.put(3, 3);
 
-        assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
         Set<Integer> keys = new TreeSet<>();
         keys.add(1);
@@ -396,7 +396,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
-        assert cache.metrics().getAverageGetTime() > 0;
+        assert cache.localMetrics().getAverageGetTime() > 0;
     }
 
     /**
@@ -405,13 +405,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testPutAvgTime() throws Exception {
         final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
 
-        assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
-        assertEquals(0, cache.metrics().getCachePuts());
+        assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
+        assertEquals(0, cache.localMetrics().getCachePuts());
 
         for (int i = 0; i < KEY_CNT; i++)
             cache.put(i, i);
 
-        assert cache.metrics().getAveragePutTime() > 0;
+        assert cache.localMetrics().getAveragePutTime() > 0;
 
         assertEquals(KEY_CNT, cache.localMetrics().getCachePuts());
 
@@ -431,8 +431,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         IgniteCache<Object, Object> cache = grid(0).cache(null);
         IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
-        assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
-        assertEquals(0, cache.metrics().getCachePuts());
+        assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
+        assertEquals(0, cache.localMetrics().getCachePuts());
 
         cacheAsync.put(1, 1);
 
@@ -440,7 +440,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
-        assert cache.metrics().getAveragePutTime() > 0;
+        assert cache.localMetrics().getAveragePutTime() > 0;
     }
 
     /**
@@ -460,8 +460,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             }
         }
 
-        assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
-        assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
+        assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
         cacheAsync.getAndPut(key, key);
 
@@ -471,8 +471,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
-        assert cache.metrics().getAveragePutTime() > 0;
-        assert cache.metrics().getAverageGetTime() > 0;
+        assert cache.localMetrics().getAveragePutTime() > 0;
+        assert cache.localMetrics().getAverageGetTime() > 0;
     }
 
     /**
@@ -492,7 +492,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             }
         }
 
-        assertEquals(0.0f, cache.metrics().getAveragePutTime());
+        assertEquals(0.0f, cache.localMetrics().getAveragePutTime());
 
         cacheAsync.putIfAbsent(key, key);
 
@@ -502,7 +502,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
-        assert cache.metrics().getAveragePutTime() > 0;
+        assert cache.localMetrics().getAveragePutTime() > 0;
     }
 
     /**
@@ -522,7 +522,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             }
         }
 
-        assertEquals(0.0f, cache.metrics().getAveragePutTime());
+        assertEquals(0.0f, cache.localMetrics().getAveragePutTime());
 
         cacheAsync.getAndPutIfAbsent(key, key);
 
@@ -532,7 +532,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
-        assert cache.metrics().getAveragePutTime() > 0;
+        assert cache.localMetrics().getAveragePutTime() > 0;
     }
 
     /**
@@ -541,8 +541,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testPutAllAvgTime() throws Exception {
         IgniteCache<Integer, Integer> cache = grid(0).cache(null);
 
-        assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
-        assertEquals(0, cache.metrics().getCachePuts());
+        assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
+        assertEquals(0, cache.localMetrics().getCachePuts());
 
         Map<Integer, Integer> values = new HashMap<>();
 
@@ -552,10 +552,10 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.putAll(values);
 
-        float averagePutTime = cache.metrics().getAveragePutTime();
+        float averagePutTime = cache.localMetrics().getAveragePutTime();
 
         assert averagePutTime >= 0;
-        assertEquals(values.size(), cache.metrics().getCachePuts());
+        assertEquals(values.size(), cache.localMetrics().getCachePuts());
     }
 
     /**
@@ -686,7 +686,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         long misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).metrics();
+            CacheMetrics m = grid(i).cache(null).localMetrics();
 
             puts += m.getCachePuts();
             reads += m.getCacheGets();
@@ -706,8 +706,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testMissesOnEmptyCache() throws Exception {
         IgniteCache<Integer, Integer> cache = grid(0).cache(null);
 
-        assertEquals("Expected 0 read", 0, cache.metrics().getCacheGets());
-        assertEquals("Expected 0 miss", 0, cache.metrics().getCacheMisses());
+        assertEquals("Expected 0 read", 0, cache.localMetrics().getCacheGets());
+        assertEquals("Expected 0 miss", 0, cache.localMetrics().getCacheMisses());
 
         Integer key =  null;
 
@@ -723,19 +723,19 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.get(key);
 
-        assertEquals("Expected 1 read", 1, cache.metrics().getCacheGets());
-        assertEquals("Expected 1 miss", 1, cache.metrics().getCacheMisses());
+        assertEquals("Expected 1 read", 1, cache.localMetrics().getCacheGets());
+        assertEquals("Expected 1 miss", 1, cache.localMetrics().getCacheMisses());
 
         cache.getAndPut(key, key); // +1 read, +1 miss.
 
-        assertEquals("Expected 2 reads", 2, cache.metrics().getCacheGets());
+        assertEquals("Expected 2 reads", 2, cache.localMetrics().getCacheGets());
 
         cache.get(key);
 
-        assertEquals("Expected 1 write", 1, cache.metrics().getCachePuts());
-        assertEquals("Expected 3 reads", 3, cache.metrics().getCacheGets());
-        assertEquals("Expected 2 misses", 2, cache.metrics().getCacheMisses());
-        assertEquals("Expected 1 hit", 1, cache.metrics().getCacheHits());
+        assertEquals("Expected 1 write", 1, cache.localMetrics().getCachePuts());
+        assertEquals("Expected 3 reads", 3, cache.localMetrics().getCacheGets());
+        assertEquals("Expected 2 misses", 2, cache.localMetrics().getCacheMisses());
+        assertEquals("Expected 1 hit", 1, cache.localMetrics().getCacheHits());
     }
 
     /**
@@ -749,7 +749,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         // +1 remove
         cache.remove(1);
 
-        assertEquals(1L, cache.metrics().getCacheRemovals());
+        assertEquals(1L, cache.localMetrics().getCacheRemovals());
     }
 
     /**
@@ -765,8 +765,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.localEvict(Collections.singleton(1));
 
-        assertEquals(0L, cache.metrics().getCacheRemovals());
-        assertEquals(1L, cache.metrics().getCacheEvictions());
+        assertEquals(0L, cache.localMetrics().getCacheRemovals());
+        assertEquals(1L, cache.localMetrics().getCacheEvictions());
     }
 
     /**


Mime
View raw message