01: /*
02: @license.text@
03: */
04: package com.pavelvlasov.metrics.sample;
05:
06: import biz.hammurapi.metrics.SimpleMetric;
07:
08: /**
09: * @author Pavel Vlasov
10: * @revision $Revision$
11: */
12: public class Deviation {
13:
14: public static void main(String[] args) {
15: SimpleMetric sm = new SimpleMetric("test");
16: double lastAvg = 0;
17: double lastDeviationn = 0;
18: int measurements = 20;
19: for (int i = 0; i < measurements; i++) {
20: int value = i % 2;
21: sm.add(value, 0);
22: System.out.println(value + " " + sm.getAvg() + " ("
23: + (sm.getAvg() - lastAvg) + ") "
24: + sm.getDeviation() + " ("
25: + (sm.getDeviation() - lastDeviationn) + ")");
26: lastAvg = sm.getAvg();
27: lastDeviationn = sm.getDeviation();
28: }
29: }
30: }
|