Package net.sourceforge.stat4j

Examples of net.sourceforge.stat4j.Reading


    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


      // Get Calculator
      Calculator calculator =
        (Calculator) calculators.get(statistic.getName());

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

      if (calculator.isApplyImmediate()) {
View Full Code Here

      // Get Calculator
      Calculator calculator =
        (Calculator) calculators.get(statistic.getName());

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

      if (calculator.isApplyImmediate()) {
View Full Code Here

        } else {
          // scrape failed
          return null;
        }
      }
      return new Reading(value);
    } else {
      return new Reading();
    }
  }
View Full Code Here

    Reading reading) {
    Map map = null;

    Map cache = getReadingCache(statistic);

    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);
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

TOP

Related Classes of net.sourceforge.stat4j.Reading

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.