Do a measure manually using a StopWatch

final Counter counter = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, "my counter"));
final StopWatch stopWatch = Repository.INSTANCE.start(counter);
// do something
stopwatch.stop();

Create a custom Gauge

public class MyRandomGauge implements Gauge {
    public static final Role MY_RANDOM_ROLE = new Role("Random", Unit.UNARY);

    @Override
    public Role role() {
        return MY_RANDOM_ROLE;
    }

    @Override
    public double value() {
        return new Random(System.currentTimeMillis()).nextDouble();
    }

    @Override
    public long period() { // millisecond
        return 4000;
    }
}

The role identifies the gauge specifying its unit (Unit.UNARY means “value” - absolute, percent…).

The value method is the one called to get the measure.

Period method defines when to do a measure using the gauge (it implicitly defines a a timer).

Get a gauge values

Gauges values are retrieved by interval:

Map<Long, Double> sortedValueByIncreasingDate = Repository.INSTANCE.getGaugeValues(start, end, gaugeRole);