Package com.jitlogic.zorka.common.stats

Examples of com.jitlogic.zorka.common.stats.MethodCallStatistic


        if (ZorkaLogger.isLogLevel(ZorkaLogger.ZSP_ARGPROC)) {
            log.debug(ZorkaLogger.ZSP_ARGPROC, "Collecting record: " + record);
        }

        MethodCallStatistic statistic = cachedStatistic;

        if (statistic == null) {

            MethodCallStatistics statistics = cachedStatistics;
            SpyContext ctx = (SpyContext) record.get(".CTX");

            if (statistics == null) {
                prefetch(record, ctx);

                statistics = statsCacheEnabled ? statsCache.get(ctx) : null;

                if (statistics == null) {
                    String mbeanName = subst(mbeanTemplate, record, ctx, mbeanFlags);
                    String attrName = subst(attrTemplate, record, ctx, attrFlags);
                    statistics = registry.getOrRegister(mbsName, mbeanName, attrName,
                            new MethodCallStatistics(), "Call stats");
                    if (statsCacheEnabled) {
                        statsCache.putIfAbsent(ctx, statistics);
                    }
                }
            }

            String key = statFlags != 0 ? subst(statTemplate, record, ctx, statFlags) : statTemplate;

            statistic = statistics.getMethodCallStatistic(key);
        }

        if (0 != (actions & ACTION_STATS)) {
            submit(record, statistic);
        }

        if (0 != (actions & ACTION_ENTER)) {
            statistic.markEnter();
        }

        if (0 != (actions & ACTION_EXIT)) {
            statistic.markExit();
        }

        return record;
    }
View Full Code Here


    }


    @Test
    public void testMaxTimeCLR() throws Exception {
        MethodCallStatistic stat = new MethodCallStatistic("A");

        stat.logCall(10L * MS);
        stat.logCall(20L * MS);

        assertEquals(20L, stat.getMaxTime());
        assertEquals(20L, stat.getMaxTimeCLR());
        assertEquals(0L, stat.getMaxTime());

        stat.logError(11L * MS);

        assertEquals(11L, stat.getMaxTimeCLR());
        assertEquals(0L, stat.getMaxTimeCLR());
    }
View Full Code Here

    }


    @Test
    public void testThreadCounter() throws Exception {
        MethodCallStatistic stat = new MethodCallStatistic("A");

        stat.markEnter();
        assertEquals(1L, stat.getMaxThreads());
        assertEquals(1L, stat.getCurThreads());

        stat.markExit();
        assertEquals(1L, stat.getMaxThreads());
        assertEquals(0L, stat.getCurThreads());
    }
View Full Code Here

        return cpuHiccup(mbsName, mbeanName, attr, 10, 30000);
    }


    public HiccupMeter cpuHiccup(String mbsName, String mbeanName, String attr, long resolution, long delay) {
        MethodCallStatistic mcs = mbsRegistry.getOrRegister(mbsName, mbeanName, attr, new MethodCallStatistic("cpuHiccup"));
        HiccupMeter meter = HiccupMeter.cpuMeter(resolution, delay, mcs);
        return meter;
    }
View Full Code Here

        return memHiccup(mbsName, mbeanName, attr, 10, 30000);
    }


    public HiccupMeter memHiccup(String mbsName, String mbeanName, String attr, long resolution, long delay) {
        MethodCallStatistic mcs = mbsRegistry.getOrRegister(mbsName, mbeanName, attr, new MethodCallStatistic("memHiccup"));
        HiccupMeter meter = HiccupMeter.memMeter(resolution, delay, mcs);
        return meter;
    }
View Full Code Here

        return dskHiccup(mbsName, mbeanName, attr, 1000, 30000, path);
    }


    public HiccupMeter dskHiccup(String mbsName, String mbeanName, String attr, long resolution, long delay, String path) {
        MethodCallStatistic mcs = mbsRegistry.getOrRegister(mbsName, mbeanName, attr, new MethodCallStatistic("dskHiccup"));
        HiccupMeter meter = HiccupMeter.dskMeter(resolution, delay, path, mcs);
        return meter;
    }
View Full Code Here

TOP

Related Classes of com.jitlogic.zorka.common.stats.MethodCallStatistic

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.