Examples of LastNValues


Examples of com.google.caliper.util.LastNValues

        }

        Collection<Measurement> run(final int targetReps) throws Exception {
            final Queue<Measurement> measurements = new LinkedList<Measurement>();
            final LastNValues recentValues = new LastNValues(options.reportedIntervals);

            log.notifyMeasurementPhaseStarting();
            for (int trials = 0; trials < 1; trials++) {
                if (options.gcBeforeEach) {
                    Util.forceGc();
                }

                log.notifyMeasurementStarting();
                final int reps = 5;
                final long nanos = invokeLatencyMethod(reps);

                final Measurement measure = new Measurement();
                measure.value = (double) nanos;
                measure.weight = (double) (reps * repeatFactor);
                measure.unit = "ns";
                measure.description = "propagation latency";
                final double nanosPerRep = measure.value / measure.weight;
                log.notifyMeasurementEnding(nanosPerRep);

                measurements.add(measure);
                if (measurements.size() > options.reportedIntervals) {
                    measurements.remove();
                }
                recentValues.add(nanosPerRep);

                if (shouldShortCircuit(recentValues)) {
                    break;
                }
            }
View Full Code Here

Examples of com.google.caliper.util.LastNValues

        }

        Collection<Measurement> run(int targetReps) throws Exception {
            long timeToStop = startTick + options.maxTotalRuntimeNanos - options.timingIntervalNanos;
            Queue<Measurement> measurements = new LinkedList<Measurement>();
            LastNValues recentValues = new LastNValues(options.reportedIntervals);

            log.notifyMeasurementPhaseStarting();

            for (int trials = 0; trials < 1; trials++) {
                int reps = 5;
                if (options.gcBeforeEach) Util.forceGc();
                log.notifyMeasurementStarting();
                long nanos = invokeTimeMethod(reps);
                double nanos_per_rep = nanos / reps;
                double seconds = (double) nanos_per_rep / 1000000000;
                double messages_per_second = totalMessages / seconds;

                Measurement m = new Measurement();
                m.value = messages_per_second;
                m.weight = 1;
                m.unit = "Messages per Second";
                m.description = "";
                double nanosPerRep = m.value / m.weight;
                log.notifyMeasurementEnding(nanosPerRep);

                measurements.add(m);
                if (measurements.size() > options.reportedIntervals) {
                    measurements.remove();
                }
                recentValues.add(nanosPerRep);

                if (shouldShortCircuit(recentValues)) {
                    break;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.