Package com.volantis.cache.stats

Examples of com.volantis.cache.stats.StatisticsSnapshot


        assertSame(value1, object);

        // Check the cache integrity.
        ensureCacheIntegrity(cache);

        StatisticsSnapshot snapshot = root.getStatisticsSnapshot();
        assertEquals(1, snapshot.getEntryCount());
        assertEquals(Time.inMilliSeconds(1010), snapshot.getGatherTime());
        assertEquals(Period.inMilliSeconds(1010), snapshot.getPeriod());
        assertEquals(1, snapshot.getHitCount());
        assertEquals(1, snapshot.getMissedAddedCount());
    }
View Full Code Here


        // Check the cache integrity.
        ensureCacheIntegrity(cache);

        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(100));

        StatisticsSnapshot snapshot = root.getStatisticsSnapshot();
        assertEquals(1, snapshot.getEntryCount());
        assertEquals(1, snapshot.getHitCount());
        assertEquals(1, snapshot.getMissedAddedCount());
    }
View Full Code Here

        // Check the cache integrity.
        ensureCacheIntegrity(cache);

        // At this point cache contains (key1, key2).
        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(2000));
        StatisticsSnapshot snapshot = root.getStatisticsSnapshot();
        assertEquals(2, snapshot.getEntryCount());
        assertEquals(1, snapshot.getHitCount());
        assertEquals(4, snapshot.getMissedAddedCount());
    }
View Full Code Here

        }
    }

    public StatisticsSnapshot getStatisticsSnapshot() {
        List groups = getGroupList();
        StatisticsSnapshot snapshot;
        if (groups == null) {
            snapshot = gatherer.getStatisticsSnapshot(this);
        } else {
            StatisticsGatherer combined = new StatisticsGatherer(gatherer);

            for (int i = 0; i < groups.size(); i++) {
                Group group = (Group) groups.get(i);
                StatisticsSnapshot nested = group.getStatisticsSnapshot();
                combined.addSnapshot(nested);
            }

            snapshot = combined.getStatisticsSnapshot(this);
        }
View Full Code Here

            Thread thread = new Thread(runnable);
            threads[i] = thread;
            runnables[i] = runnable;
        }

        StatisticsSnapshot snapshotBefore = rootGroup.getStatisticsSnapshot();

        for (int i = 0; i < threads.length; i++) {
            Thread thread = threads[i];
            thread.start();
        }

        boolean failed = false;
        for (int i = 0; i < threads.length; i++) {
            Thread thread = threads[i];
            MyRunnable runnable = runnables[i];
            thread.join();

            if (runnable.failed()) {
                String errors = runnable.getErrors();
                if (errors != null) {
                    if (logger.isDebugEnabled()) {
                        logger.debug(errors);
                    }
                }
                failed = true;
            }
        }
        if (failed) {
            fail("Stress test failed due to exceptions thrown by threads");
        }

        // Validate the internal structure of the cache.
        ensureCacheIntegrity(cache);

        StatisticsSnapshot snapshotAfter = rootGroup.getStatisticsSnapshot();
        StatisticsDelta delta = snapshotAfter.difference(snapshotBefore);
        System.out.println("Period:                 " + delta.getPeriod());
        System.out.println("Hit count:              " + delta.getHitCount());
        System.out.println("Missed / Added count:   " + delta.getMissedAddedCount());
        System.out.println("Removed count:          " + delta.getRemovedCount());
        System.out.println("Change count:           " +
View Full Code Here

TOP

Related Classes of com.volantis.cache.stats.StatisticsSnapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.