Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-51 71c7a694c -> d9f4e3b2c


# IGNITE-145 Updated cache metrics.


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

Branch: refs/heads/ignite-51
Commit: 14954f7b7fbfe11004b4de3303df840875036679
Parents: 5c4aa2d
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Thu Feb 5 18:16:00 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Thu Feb 5 18:16:00 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheMetrics.java   |   2 +-
 .../cache/VisorCacheAggregatedMetrics.java      |  88 ++---
 .../internal/visor/cache/VisorCacheMetrics.java | 337 +++++++++++++++----
 .../commands/cache/VisorCacheCommand.scala      |  54 +--
 4 files changed, 321 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/14954f7b/modules/core/src/main/java/org/apache/ignite/cache/CacheMetrics.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/cache/CacheMetrics.java 
b/modules/core/src/main/java/org/apache/ignite/cache/CacheMetrics.java
index da4bceb..d21b12b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheMetrics.java
@@ -168,7 +168,7 @@ public interface CacheMetrics {
     public long getOffHeapAllocatedSize();
 
     /**
-     * Returns number of non-{@code null} values in the cache.
+     * Gets number of non-{@code null} values in the cache.
      *
      * @return Number of non-{@code null} values in the cache.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/14954f7b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index 6204bd4..ef502ed 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -44,47 +44,41 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /** Maximum number of elements in the cache. */
     private transient Integer maxSize;
 
-    /** Gets last read time of the owning cache. */
-    private transient Long lastRead;
-
-    /** Gets last read time of the owning cache. */
-    private transient Long lastWrite;
-
     /** Minimum hits of the owning cache. */
-    private transient Integer minHits;
+    private transient Long minHits;
 
     /** Average hits of the owning cache. */
     private transient Double avgHits;
 
     /** Maximum hits of the owning cache. */
-    private transient Integer maxHits;
+    private transient Long maxHits;
 
     /** Minimum misses of the owning cache. */
-    private transient Integer minMisses;
+    private transient Long minMisses;
 
     /** Average misses of the owning cache. */
     private transient Double avgMisses;
 
     /** Maximum misses of the owning cache. */
-    private transient Integer maxMisses;
+    private transient Long maxMisses;
 
     /** Minimum total number of reads of the owning cache. */
-    private transient Integer minReads;
+    private transient Long minReads;
 
     /** Average total number of reads of the owning cache. */
     private transient Double avgReads;
 
     /** Maximum total number of reads of the owning cache. */
-    private transient Integer maxReads;
+    private transient Long maxReads;
 
     /** Minimum total number of writes of the owning cache. */
-    private transient Integer minWrites;
+    private transient Long minWrites;
 
     /** Average total number of writes of the owning cache. */
     private transient Double avgWrites;
 
     /** Maximum total number of writes of the owning cache. */
-    private transient Integer maxWrites;
+    private transient Long maxWrites;
 
     /** Minimum execution time of query. */
     private transient Long minQryTime;
@@ -135,7 +129,7 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
             minSize = Integer.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minSize = Math.min(minSize, metric.size());
+                minSize = Math.min(minSize, metric.keySize());
         }
 
         return minSize;
@@ -149,7 +143,7 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
             avgSize = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgSize += metric.size();
+                avgSize += metric.keySize();
 
             avgSize /= metrics.size();
         }
@@ -165,46 +159,18 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
             maxSize = Integer.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxSize = Math.max(maxSize, metric.size());
+                maxSize = Math.max(maxSize, metric.keySize());
         }
 
         return maxSize;
     }
 
     /**
-     * @return Last read time of the owning cache.
-     */
-    public long lastRead() {
-        if (lastRead == null) {
-            lastRead = Long.MIN_VALUE;
-
-            for (VisorCacheMetrics metric : metrics.values())
-                lastRead = Math.max(lastRead, metric.readTime());
-        }
-
-        return lastRead;
-    }
-
-    /**
-     * @return Last read time of the owning cache.
-     */
-    public long lastWrite() {
-        if (lastWrite == null) {
-            lastWrite = Long.MIN_VALUE;
-
-            for (VisorCacheMetrics metric : metrics.values())
-                lastWrite = Math.max(lastWrite, metric.readTime());
-        }
-
-        return lastWrite;
-    }
-
-    /**
      * @return Minimum hits of the owning cache.
      */
-    public int minimumHits() {
+    public long minimumHits() {
         if (minHits == null) {
-            minHits = Integer.MAX_VALUE;
+            minHits = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 minHits = Math.min(minHits, metric.hits());
@@ -232,9 +198,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Maximum hits of the owning cache.
      */
-    public int maximumHits() {
+    public long maximumHits() {
         if (maxHits == null) {
-            maxHits = Integer.MIN_VALUE;
+            maxHits = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 maxHits = Math.max(maxHits, metric.hits());
@@ -246,9 +212,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Minimum misses of the owning cache.
      */
-    public int minimumMisses() {
+    public long minimumMisses() {
         if (minMisses == null) {
-            minMisses = Integer.MAX_VALUE;
+            minMisses = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 minMisses = Math.min(minMisses, metric.misses());
@@ -276,9 +242,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Maximum misses of the owning cache.
      */
-    public int maximumMisses() {
+    public long maximumMisses() {
         if (maxMisses == null) {
-            maxMisses = Integer.MIN_VALUE;
+            maxMisses = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 maxMisses = Math.max(maxMisses, metric.misses());
@@ -290,9 +256,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Minimum total number of reads of the owning cache.
      */
-    public int minimumReads() {
+    public long minimumReads() {
         if (minReads == null) {
-            minReads = Integer.MAX_VALUE;
+            minReads = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 minReads = Math.min(minReads, metric.reads());
@@ -320,9 +286,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Maximum total number of reads of the owning cache.
      */
-    public int maximumReads() {
+    public long maximumReads() {
         if (maxReads == null) {
-            maxReads = Integer.MIN_VALUE;
+            maxReads = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 maxReads = Math.max(maxReads, metric.reads());
@@ -334,9 +300,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Minimum total number of writes of the owning cache.
      */
-    public int minimumWrites() {
+    public long minimumWrites() {
         if (minWrites == null) {
-            minWrites = Integer.MAX_VALUE;
+            minWrites = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 minWrites = Math.min(minWrites, metric.writes());
@@ -364,9 +330,9 @@ public class VisorCacheAggregatedMetrics implements 
Serializable {
     /**
      * @return Maximum total number of writes of the owning cache.
      */
-    public int maximumWrites() {
+    public long maximumWrites() {
         if (maxWrites == null) {
-            maxWrites = Integer.MIN_VALUE;
+            maxWrites = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
                 maxWrites = Math.max(maxWrites, metric.writes());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/14954f7b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 6f97185..0db8572 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -32,41 +32,53 @@ public class VisorCacheMetrics implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Gets the number of all entries cached on this node. */
+    /** Number of non-{@code null} values in the cache. */
     private int size;
 
-    /** Create time of the owning entity (either cache or entry). */
-    private long createTm;
-
-    /** Last write time of the owning entity (either cache or entry). */
-    private long writeTm;
-
-    /** Last read time of the owning entity (either cache or entry). */
-    private long readTm;
-
-    /** Last time transaction was committed. */
-    private long commitTm;
-
-    /** Last time transaction was rollback. */
-    private long rollbackTm;
+    /** Gets number of keys in the cache, possibly with {@code null} values. */
+    private int keySize;
 
     /** Total number of reads of the owning entity (either cache or entry). */
-    private int reads;
+    private long reads;
+
+    /** The mean time to execute gets. */
+    private float avgReadTime;
 
     /** Total number of writes of the owning entity (either cache or entry). */
-    private int writes;
+    private long writes;
 
     /** Total number of hits for the owning entity (either cache or entry). */
-    private int hits;
+    private long hits;
 
     /** Total number of misses for the owning entity (either cache or entry). 
*/
-    private int misses;
+    private long misses;
 
     /** Total number of transaction commits. */
-    private int txCommits;
+    private long txCommits;
+
+    /** The mean time to execute tx commit. */
+    private float avgTxCommitTime;
 
     /** Total number of transaction rollbacks. */
-    private int txRollbacks;
+    private long txRollbacks;
+
+    /** The mean time to execute tx rollbacks. */
+    private float avgTxRollbackTime;
+
+    /** The total number of puts to the cache. */
+    private long puts;
+
+    /** The mean time to execute puts. */
+    private float avgPutTime;
+
+    /** The total number of removals from the cache. */
+    private long removals;
+
+    /** The mean time to execute removes. */
+    private float avgRemovalTime;
+
+    /** The total number of evictions from the cache. */
+    private long evictions;
 
     /** Reads per second. */
     private int readsPerSec;
@@ -89,6 +101,51 @@ public class VisorCacheMetrics implements Serializable {
     /** Gets query metrics for cache. */
     private VisorCacheQueryMetrics qryMetrics;
 
+    /** Current size of evict queue used to batch up evictions. */
+    private int dhtEvictQueueCurrentSize;
+
+    /** Gets transaction per-thread map size. */
+    private int txThreadMapSize;
+
+    /** Transaction per-Xid map size. */
+    private int txXidMapSize;
+
+    /** Committed transaction queue size. */
+    private int txCommitQueueSize;
+
+    /** Prepared transaction queue size. */
+    private int txPrepareQueueSize;
+
+    /** Start version counts map size. */
+    private int txStartVersionCountsSize;
+
+    /** Number of cached committed transaction IDs. */
+    private int txCommittedVersionsSize;
+
+    /** Number of cached rolled back transaction IDs. */
+    private int txRolledbackVersionsSize;
+
+    /** DHT thread map size */
+    private int txDhtThreadMapSize;
+
+    /** Transaction DHT per-Xid map size. */
+    private int txDhtXidMapSize;
+
+    /** Committed DHT transaction queue size. */
+    private int txDhtCommitQueueSize;
+
+    /** Prepared DHT transaction queue size. */
+    private int txDhtPrepareQueueSize;
+
+    /** DHT start version counts map size. */
+    private int txDhtStartVersionCountsSize;
+
+    /** Number of cached committed DHT transaction IDs. */
+    private int txDhtCommittedVersionsSize;
+
+    /** Number of cached rolled back DHT transaction IDs. */
+    private int txDhtRolledbackVersionsSize;
+
     /** Calculate rate of metric per second. */
     private static int perSecond(int metric, long time, long createTime) {
         long seconds = (time - createTime) / 1000;
@@ -105,15 +162,27 @@ public class VisorCacheMetrics implements Serializable {
 
         CacheMetrics m = c.metrics();
 
-        cm.size = c.size();
+        cm.size = m.getSize();
+        cm.keySize = m.getKeySize();
+
+        cm.reads = m.getCacheGets();
+        cm.writes = m.getCachePuts() + m.getCacheRemovals();
+        cm.hits = m.getCacheHits();
+        cm.misses = m.getCacheMisses();
 
-        cm.reads = (int)m.getCacheGets();
-        cm.writes = (int)(m.getCachePuts() + m.getCacheRemovals());
-        cm.hits = (int)m.getCacheHits();
-        cm.misses = (int)m.getCacheMisses();
+        cm.txCommits = m.getCacheTxCommits();
+        cm.txRollbacks = m.getCacheTxRollbacks();
 
-        cm.txCommits = (int)m.getCacheTxCommits();
-        cm.txRollbacks = (int)m.getCacheTxRollbacks();
+        cm.avgTxCommitTime = m.getAverageTxCommitTime();
+        cm.avgTxRollbackTime = m.getAverageTxRollbackTime();
+
+        cm.puts = m.getCachePuts();
+        cm.removals = m.getCacheRemovals();
+        cm.evictions = m.getCacheEvictions();
+
+        cm.avgReadTime = m.getAverageGetTime();
+        cm.avgPutTime = m.getAveragePutTime();
+        cm.avgRemovalTime = m.getAverageRemoveTime();
 
         cm.readsPerSec = (int)(MICROSECONDS_IN_SECOND * 1.f / 
m.getAverageGetTime());
         cm.writesPerSec = (int)(MICROSECONDS_IN_SECOND * 1.f / 
m.getAveragePutTime());
@@ -124,83 +193,120 @@ public class VisorCacheMetrics implements Serializable {
 
         cm.qryMetrics = VisorCacheQueryMetrics.from(c.queries().metrics());
 
+        cm.dhtEvictQueueCurrentSize = m.getDhtEvictQueueCurrentSize();
+        cm.txThreadMapSize = m.getTxThreadMapSize();
+        cm.txXidMapSize = m.getTxXidMapSize();
+        cm.txCommitQueueSize = m.getTxCommitQueueSize();
+        cm.txPrepareQueueSize = m.getTxPrepareQueueSize();
+        cm.txStartVersionCountsSize = m.getTxStartVersionCountsSize();
+        cm.txCommittedVersionsSize = m.getTxCommittedVersionsSize();
+        cm.txRolledbackVersionsSize = m.getTxRolledbackVersionsSize();
+        cm.txDhtThreadMapSize = m.getTxDhtThreadMapSize();
+        cm.txDhtXidMapSize = m.getTxDhtXidMapSize();
+        cm.txDhtCommitQueueSize = m.getTxDhtCommitQueueSize();
+        cm.txDhtPrepareQueueSize = m.getTxDhtPrepareQueueSize();
+        cm.txDhtStartVersionCountsSize = m.getTxDhtStartVersionCountsSize();
+        cm.txDhtCommittedVersionsSize = m.getTxDhtCommittedVersionsSize();
+        cm.txDhtRolledbackVersionsSize = m.getTxDhtRolledbackVersionsSize();
+
         return cm;
     }
 
     /**
-     * @return Create time of the owning entity (either cache or entry).
+     * @return Total number of reads of the owning entity (either cache or 
entry).
      */
-    public long createTime() {
-        return createTm;
+    public long reads() {
+        return reads;
     }
 
     /**
-     * @return Last write time of the owning entity (either cache or entry).
+     * @return The mean time to execute gets
      */
-    public long writeTime() {
-        return writeTm;
+    public float avgReadTime() {
+        return avgReadTime;
     }
 
     /**
-     * @return Last read time of the owning entity (either cache or entry).
+     * @return Total number of writes of the owning entity (either cache or 
entry).
      */
-    public long readTime() {
-        return readTm;
+    public long writes() {
+        return writes;
     }
 
     /**
-     * @return Last time transaction was committed.
+     * @return Total number of hits for the owning entity (either cache or 
entry).
      */
-    public long commitTime() {
-        return commitTm;
+    public long hits() {
+        return hits;
     }
 
     /**
-     * @return Last time transaction was rollback.
+     * @return Total number of misses for the owning entity (either cache or 
entry).
      */
-    public long rollbackTime() {
-        return rollbackTm;
+    public long misses() {
+        return misses;
     }
 
     /**
-     * @return Total number of reads of the owning entity (either cache or 
entry).
+     * @return Total number of transaction commits.
      */
-    public int reads() {
-        return reads;
+    public long txCommits() {
+        return txCommits;
     }
 
     /**
-     * @return Total number of writes of the owning entity (either cache or 
entry).
+     * @return avgTxCommitTime
      */
-    public int writes() {
-        return writes;
+    public float avgTxCommitTime() {
+        return avgTxCommitTime;
     }
 
     /**
-     * @return Total number of hits for the owning entity (either cache or 
entry).
+     * @return The mean time to execute tx rollbacks.
      */
-    public int hits() {
-        return hits;
+    public float avgTxRollbackTime() {
+        return avgTxRollbackTime;
     }
 
     /**
-     * @return Total number of misses for the owning entity (either cache or 
entry).
+     * @return The total number of puts to the cache.
      */
-    public int misses() {
-        return misses;
+    public long puts() {
+        return puts;
     }
 
     /**
-     * @return Total number of transaction commits.
+     * @return The mean time to execute puts.
      */
-    public int txCommits() {
-        return txCommits;
+    public float avgPutTime() {
+        return avgPutTime;
+    }
+
+    /**
+     * @return The total number of removals from the cache.
+     */
+    public long removals() {
+        return removals;
+    }
+
+    /**
+     * @return The mean time to execute removes.
+     */
+    public float avgRemovalTime() {
+        return avgRemovalTime;
+    }
+
+    /**
+     * @return The total number of evictions from the cache.
+     */
+    public long evictions() {
+        return evictions;
     }
 
     /**
      * @return Total number of transaction rollbacks.
      */
-    public int txRollbacks() {
+    public long txRollbacks() {
         return txRollbacks;
     }
 
@@ -247,19 +353,130 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
-     * @return Gets the number of all entries cached on this node.
+     * @return Number of non-{@code null} values in the cache.
      */
     public int size() {
         return size;
     }
 
     /**
+     * @return Gets number of keys in the cache, possibly with {@code null} 
values.
+     */
+    public int keySize() {
+        return keySize;
+    }
+
+    /**
      * @return Gets query metrics for cache.
      */
     public VisorCacheQueryMetrics queryMetrics() {
         return qryMetrics;
     }
 
+    /**
+     * @return Current size of evict queue used to batch up evictions.
+     */
+    public int dhtEvictQueueCurrentSize() {
+        return dhtEvictQueueCurrentSize;
+    }
+
+    /**
+     * @return Gets transaction per-thread map size.
+     */
+    public int txThreadMapSize() {
+        return txThreadMapSize;
+    }
+
+    /**
+     * @return Transaction per-Xid map size.
+     */
+    public int txXidMapSize() {
+        return txXidMapSize;
+    }
+
+    /** Committed transaction queue size.
+     */
+    public int txCommitQueueSize() {
+        return txCommitQueueSize;
+    }
+
+    /**
+     * @return Prepared transaction queue size.
+     */
+    public int txPrepareQueueSize() {
+        return txPrepareQueueSize;
+    }
+
+    /**
+     * @return Start version counts map size.
+     */
+    public int txStartVersionCountsSize() {
+        return txStartVersionCountsSize;
+    }
+
+    /**
+     * @return Number of cached committed transaction IDs.
+     */
+    public int txCommittedVersionsSize() {
+        return txCommittedVersionsSize;
+    }
+
+    /**
+     * @return Number of cached rolled back transaction IDs.
+     */
+    public int txRolledbackVersionsSize() {
+        return txRolledbackVersionsSize;
+    }
+
+    /**
+     * @return DHT thread map size
+     */
+    public int txDhtThreadMapSize() {
+        return txDhtThreadMapSize;
+    }
+
+    /**
+     * @return Transaction DHT per-Xid map size.
+     */
+    public int txDhtXidMapSize() {
+        return txDhtXidMapSize;
+    }
+
+    /**
+     * @return Committed DHT transaction queue size.
+     */
+    public int txDhtCommitQueueSize() {
+        return txDhtCommitQueueSize;
+    }
+
+    /**
+     * @return Prepared DHT transaction queue size.
+     */
+    public int txDhtPrepareQueueSize() {
+        return txDhtPrepareQueueSize;
+    }
+
+    /**
+     * @return DHT start version counts map size.
+     */
+    public int txDhtStartVersionCountsSize() {
+        return txDhtStartVersionCountsSize;
+    }
+
+    /**
+     * @return Number of cached committed DHT transaction IDs.
+     */
+    public int txDhtCommittedVersionsSize() {
+        return txDhtCommittedVersionsSize;
+    }
+
+    /**
+     * @return Number of cached rolled back DHT transaction IDs.
+     */
+    public int txDhtRolledbackVersionsSize() {
+        return txDhtRolledbackVersionsSize;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheMetrics.class, this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/14954f7b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git 
a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
 
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 575ce82..ca7c96a 100644
--- 
a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ 
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -67,7 +67,7 @@ import scala.util.control.Breaks._
  * {{{
  *     cache
  *     cache -i
- *     cache {-c=<cache-name>} {-id=<node-id>|id8=<node-id8>} 
{-s=lr|lw|hi|mi|re|wr} {-a} {-r}
+ *     cache {-c=<cache-name>} {-id=<node-id>|id8=<node-id8>} 
{-s=hi|mi|re|wr|cn} {-a} {-r}
  *     cache -clear {-c=<cache-name>}
  *     cache -compact {-c=<cache-name>}
  *     cache -scan -c=<cache-name> {-id=<node-id>|id8=<node-id8>} {-p=<page 
size>}
@@ -86,15 +86,14 @@ import scala.util.control.Breaks._
  *         If neither is specified statistics will be gathered from all nodes.
  *     -c=<cache-name>
  *         Name of the cache.
- *     -s=lr|lw|hi|mi|re|wr|cn
+ *     -s=hi|mi|re|wr|cn
  *         Defines sorting type. Sorted by:
- *            lr Last read.
- *            lw Last write.
  *            hi Hits.
  *            mi Misses.
  *            rd Reads.
  *            wr Writes.
- *         If not specified - default sorting is 'lr'.
+ *            cn Cache name.
+ *         If not specified - default sorting is 'cn'.
  *     -i
  *         Interactive mode.
  *         User can interactively select node for cache statistics.
@@ -289,20 +288,15 @@ class VisorCacheCommand {
 
                 val sumT = VisorTextTable()
 
-                sumT #= (("Name(@),", "Last Read/Write"), "Nodes", "Entries", 
"Hits", "Misses", "Reads", "Writes")
+                sumT #= ("Name(@),", "Nodes", "Entries", "Hits", "Misses", 
"Reads", "Writes")
 
-                sortAggregatedData(aggrData, sortType.getOrElse("lr"), 
reversed).foreach(
+                sortAggregatedData(aggrData, sortType.getOrElse("cn"), 
reversed).foreach(
                     ad => {
                         // Add cache host as visor variable.
                         registerCacheName(ad.cacheName)
 
                         sumT += (
-                            (
-                                mkCacheName(ad.cacheName),
-                                " ",
-                                formatDateTime(ad.lastRead),
-                                formatDateTime(ad.lastWrite)
-                                ),
+                            mkCacheName(ad.cacheName),
                             ad.nodes,
                             (
                                 "min: " + ad.minimumSize,
@@ -363,10 +357,9 @@ class VisorCacheCommand {
 
                         val ciT = VisorTextTable()
 
-                        ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU 
Load", "Up Time", "Size",
-                            "Last Read/Write", "Hi/Mi/Rd/Wr")
+                        ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU 
Load", "Up Time", "Size", "Hi/Mi/Rd/Wr")
 
-                        sortData(m.toMap, sortType.getOrElse("lr"), 
reversed).foreach { case (nid, cm) => {
+                        sortData(m.toMap, sortType.getOrElse("hi"), 
reversed).foreach { case (nid, cm) => {
                             val nm = grid.node(nid).metrics()
 
                             ciT += (
@@ -376,11 +369,7 @@ class VisorCacheCommand {
 
                                 formatDouble(nm.getCurrentCpuLoad * 100.0) + " 
%",
                                 X.timeSpan2HMSM(nm.getUpTime),
-                                cm.size(),
-                                (
-                                    formatDateTime(cm.readTime),
-                                    formatDateTime(cm.writeTime)
-                                ),
+                                cm.keySize(),
                                 (
                                     "Hi: " + cm.hits(),
                                     "Mi: " + cm.misses(),
@@ -511,7 +500,7 @@ class VisorCacheCommand {
     private def isValidSortType(arg: String): Boolean = {
         assert(arg != null)
 
-        Set("lr", "lw", "hi", "mi", "rd", "wr", "cn").contains(arg.trim)
+        Set("hi", "mi", "rd", "wr", "cn").contains(arg.trim)
     }
 
     /**
@@ -527,8 +516,6 @@ class VisorCacheCommand {
         assert(arg != null)
 
         val sorted = arg.trim match {
-            case "lr" => data.toSeq.sortBy(_._2.readTime)
-            case "lw" => data.toSeq.sortBy(_._2.writeTime)
             case "hi" => data.toSeq.sortBy(_._2.hits)
             case "mi" => data.toSeq.sortBy(_._2.misses)
             case "rd" => data.toSeq.sortBy(_._2.reads)
@@ -556,8 +543,6 @@ class VisorCacheCommand {
         List[VisorCacheAggregatedMetrics] = {
 
         val sorted = arg.trim match {
-            case "lr" => data.toList.sortBy(_.lastRead)
-            case "lw" => data.toList.sortBy(_.lastWrite)
             case "hi" => data.toList.sortBy(_.averageHits)
             case "mi" => data.toList.sortBy(_.averageMisses)
             case "rd" => data.toList.sortBy(_.averageReads)
@@ -596,7 +581,7 @@ class VisorCacheCommand {
 
         val sumT = VisorTextTable()
 
-        sumT #= ("#", ("Name(@),", "Last Read/Write"), "Nodes", "Size")
+        sumT #= ("#", "Name(@),", "Nodes", "Size")
 
         (0 until sortedAggrData.size) foreach (i => {
             val ad = sortedAggrData(i)
@@ -606,12 +591,7 @@ class VisorCacheCommand {
 
             sumT += (
                 i,
-                (
-                    mkCacheName(ad.cacheName),
-                    " ",
-                    formatDateTime(ad.lastRead),
-                    formatDateTime(ad.lastWrite)
-                    ),
+                mkCacheName(ad.cacheName),
                 ad.nodes,
                 (
                     "min: " + ad.minimumSize,
@@ -668,7 +648,7 @@ object VisorCacheCommand {
         spec = Seq(
             "cache",
             "cache -i",
-            "cache {-c=<cache-name>} {-id=<node-id>|id8=<node-id8>} 
{-s=lr|lw|hi|mi|re|wr} {-a} {-r}",
+            "cache {-c=<cache-name>} {-id=<node-id>|id8=<node-id8>} 
{-s=hi|mi|re|wr} {-a} {-r}",
             "cache -compact {-c=<cache-name>} {-id=<node-id>|id8=<node-id8>}",
             "cache -clear {-c=<cache-name>} {-id=<node-id>|id8=<node-id8>}",
             "cache -scan -c=<cache-name> {-id=<node-id>|id8=<node-id8>} 
{-p=<page size>}",
@@ -702,16 +682,14 @@ object VisorCacheCommand {
             "-swap" -> Seq(
                 "Swaps backup entries in cache."
             ),
-            "-s=lr|lw|hi|mi|re|wr|cn" -> Seq(
+            "-s=hi|mi|re|wr|cn" -> Seq(
                 "Defines sorting type. Sorted by:",
-                "   lr Last read.",
-                "   lw Last write.",
                 "   hi Hits.",
                 "   mi Misses.",
                 "   rd Reads.",
                 "   wr Writes.",
                 "   cn Cache name.",
-                "If not specified - default sorting is 'lr'."
+                "If not specified - default sorting is 'cn'."
             ),
             "-i" -> Seq(
                 "Interactive mode.",

Reply via email to