summaryrefslogtreecommitdiff
path: root/src/bench.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2017-03-17 01:24:44 +0100
committerLinus Nordberg <linus@nordu.net>2017-06-27 14:17:28 +0200
commitdf2441c6315de4b245e1faf5b72517c5199fe179 (patch)
tree868a0ffb98f511c7558aae05fded1c4ee5ad23c5 /src/bench.erl
parent5eecd85c8e9e9b52527859917cba0b68608b8c33 (diff)
Added benchmark reporting.
Diffstat (limited to 'src/bench.erl')
-rw-r--r--src/bench.erl18
1 files changed, 18 insertions, 0 deletions
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.