summaryrefslogtreecommitdiff
path: root/src/bench.erl
blob: 06e477734a9ad5dbb20a07d37074bee3e50894d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
%%% Copyright (c) 2017, NORDUnet A/S.
%%% See LICENSE for licensing information.

-module(bench).

-export([timingpoint/3]).

timingpoint(Service, Target, Tag) ->
    Thispoint = plop_compat:monotonic_time(millisecond),
    Seq = plop_compat:unique_integer([monotonic]),
    case get(bench_lastpoint) of
        undefined ->
            statusreport:bench(Service, Target, Tag, Seq, Thispoint + plop_compat:time_offset(millisecond), null);
        Lastpoint ->
            statusreport:bench(Service, Target, Tag, Seq, Lastpoint + plop_compat:time_offset(millisecond), Thispoint - Lastpoint)
    end,
    put(bench_lastpoint, Thispoint),
    ok.