From df2441c6315de4b245e1faf5b72517c5199fe179 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Fri, 17 Mar 2017 01:24:44 +0100 Subject: Added benchmark reporting. --- src/bench.erl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/bench.erl (limited to 'src/bench.erl') diff --git a/src/bench.erl b/src/bench.erl new file mode 100644 index 0000000..06e4777 --- /dev/null +++ b/src/bench.erl @@ -0,0 +1,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. -- cgit v1.1