@@ -0,0 +1,2063 @@
+package org.infinispan.demo;%0A%0Aimport org.infinispan.Cache;%0Aimport org.infinispan.configuration.cache.ConfigurationBuilder;%0Aimport org.infinispan.manager.DefaultCacheManager;%0Aimport org.infinispan.manager.EmbeddedCacheManager;%0Aimport org.infinispan.stats.Stats;%0A%0Apublic class Statistics %7B%0A    %0A    public static void main(String%5B%5D args) throws Exception %7B%0A        printStatsDefault();%0A    %7D%0A    %0A    public static void printStatsDefault() %7B%0A        ConfigurationBuilder cb = new ConfigurationBuilder();%0A        cb.jmxStatistics().enable();%0A        EmbeddedCacheManager cm =  new DefaultCacheManager(cb.build());%0A        Cache%3CString, String%3E cache = cm.getCache();%0A        %0A        doCacheOps(cache);%0A        %0A        Stats stats = cache.getAdvancedCache().getStats();%0A        printStats(stats);%0A    %7D%0A    %0A    %0A    private static void doCacheOps(Cache%3CString, String%3E cache) %7B%0A        cache.put(%22key1%22, %22value1%22);%0A        cache.put(%22key2%22, %22value2%22);%0A        cache.put(%22key3%22, %22value3%22);%0A        cache.put(%22key4%22, %22value4%22);%0A        cache.put(%22key5%22, %22value5%22);%0A        %0A        cache.evict(%22key2%22);%0A        cache.remove(%22key2%22);%0A        cache.remove(%22key5%22);%0A        %0A        cache.get(%22key1%22);%0A        cache.get(%22key2%22);%0A        %0A    %7D%0A    %0A    private static void printStats(Stats stats) %7B%0A        System.out.println(%22AVG read time: %22 + stats.getAverageReadTime());%0A        System.out.println(%22AVG remove time: %22 + stats.getAverageRemoveTime());%0A        System.out.println(%22AVG write time: %22 + stats.getAverageWriteTime());%0A        System.out.println(%22Curr. # of entries: %22 + stats.getCurrentNumberOfEntries());%0A        System.out.println(%22Curr. # of entries in memory: %22 + stats.getCurrentNumberOfEntriesInMemory());%0A        System.out.println(%22Evictions: %22 + stats.getEvictions());%0A        System.out.println(%22Hits: %22 + stats.getHits());%0A        System.out.println(%22Misses: %22 + stats.getMisses());%0A        System.out.println(%22Misses: %22 + stats.getRemoveMisses());%0A        System.out.println(%22Off-heap memory used: %22 + stats.getOffHeapMemoryUsed());%0A    %7D%0A%0A%7D%0A

Create statistics example