Package net.sourceforge.stat4j

Examples of net.sourceforge.stat4j.Metric


        generateReading(statistic, statistic.getSecond(), log);
      if (reading == null)
        continue;

      if (calculator.isApplyImmediate()) {
        Metric metric = new Metric(statistic.getName(), null, reading);
        calculateStatistic(calculator, metric);

      } else {
        matchReading(statistic, calculator, reading);
      }
View Full Code Here


        generateReading(statistic, statistic.getFirst(), log);
      if (reading == null)
        continue;

      if (calculator.isApplyImmediate()) {
        Metric metric = new Metric(statistic.getName(), reading);
        calculateStatistic(calculator, metric);

      } else {
        cacheReading(statistic, reading);
      }
View Full Code Here

    Reading first = (Reading) cache.get(statistic.getName());

    // found match to this reading
    if (first != null) {
      // generate metric
      Metric metric = new Metric(statistic.getName(), first, reading);
      calculateStatistic(calculator, metric);
     
      // clear first reading from cache
      // ready to collect again
      cache.remove(statistic.getName());
View Full Code Here

    }


    public void testShouldAccumulateOccurrences() throws Exception {

        Metric metric = new Metric("metric", new Reading());

        for (int i = 0; i < 5; i++) {
            rate.applyMetric(metric);
        }
View Full Code Here

    public void testShouldResetWhenLivingLongerThenItsPeriod() throws Exception {

        long timePeriodPlusOne = rate.starttimestamp + rate.period + 1;

        Reading reading = new SettableReading().withTimestamp(timePeriodPlusOne);
        Metric muchYoungerMetric = new Metric("metric", reading);

        // Old period's readings
        Metric oldMetric = new Metric("metric", new Reading());
        rate.applyMetric(oldMetric);
        assertEquals(1, (int) rate.getResult());

        // Force new period by pretending a measure from far future
        rate.applyMetric(muchYoungerMetric);
View Full Code Here

TOP

Related Classes of net.sourceforge.stat4j.Metric

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.