From f05ba6e207440db7943f6e1f1376f98e8b4fce80 Mon Sep 17 00:00:00 2001 From: Jesper Louis Andersen Date: Sat, 29 Aug 2015 21:30:31 +0200 Subject: [PATCH] Introduce the DTrace scripts used to measure the performance in the project. --- .gitignore | 1 - bench/enacl_nif.d | 37 +++++++++++++++++++++++++++++++++++++ bench/funcall_enacl.d | 9 +++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 bench/enacl_nif.d create mode 100644 bench/funcall_enacl.d diff --git a/.gitignore b/.gitignore index bafa3c4..a8ba155 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ ebin *.beam *.o -*.d *.eqc *.so eqc_test/.eqc-info diff --git a/bench/enacl_nif.d b/bench/enacl_nif.d new file mode 100644 index 0000000..2101cc8 --- /dev/null +++ b/bench/enacl_nif.d @@ -0,0 +1,37 @@ +/* Dirty NIF schedule overhead */ +pid$target:beam.smp:schedule_dirty_cpu_nif:return +{ + s = timestamp; +} + +pid$target:libsodium.so.*:randombytes:entry { + e = timestamp; +} + +pid$target:beam.smp:execute_dirty_nif:entry +/s != 0/ +{ + @SchedTime = lquantize(timestamp - s, 0, 10000, 250); + s = 0; +} + +pid$target:beam.smp:execute_dirty_nif:return +{ + @ExecTime = lquantize(timestamp - e, 0, 10000, 250); + e = 0; + r = timestamp; +} + +pid$target:beam.smp:dirty_nif_finalizer:entry +/r != 0/ +{ + @ReturnTime = lquantize(timestamp - r, 0, 10000, 250); + r = 0; +} + +END +{ + printa("Scheduling overhead (nanos):%@d\n", @SchedTime); + printa("Return overhead (nanos):%@d\n", @ReturnTime); + printa("Exec time (nanos):%@d\n", @ExecTime); +} diff --git a/bench/funcall_enacl.d b/bench/funcall_enacl.d new file mode 100644 index 0000000..c0a938f --- /dev/null +++ b/bench/funcall_enacl.d @@ -0,0 +1,9 @@ +erlang*:::nif-entry +{ + funcall_entry_ts[cpu, copyinstr(arg1)] = vtimestamp; +} + +erlang*:::nif-return +{ + @time[cpu, copyinstr(arg1)] = lquantize((vtimestamp - funcall_entry_ts[cpu, copyinstr(arg1)] ), 0, 60000, 1000); +}