aboutsummaryrefslogtreecommitdiff
path: root/contrib/benchmark
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-08-18 15:10:39 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-08-18 15:10:39 +0200
commitaf99085b7163fdded4dfad94fd2a98231bc12209 (patch)
treec055728c186a49be04c4381bf10f890eaba482c6 /contrib/benchmark
parentec8162bdf0db6282fbf507e6da72b056119c7805 (diff)
downloadgnunet-af99085b7163fdded4dfad94fd2a98231bc12209.tar.gz
gnunet-af99085b7163fdded4dfad94fd2a98231bc12209.zip
benchmark collection awk scripts
Diffstat (limited to 'contrib/benchmark')
-rw-r--r--contrib/benchmark/collect_ops.awk45
-rw-r--r--contrib/benchmark/collect_urls.awk47
2 files changed, 92 insertions, 0 deletions
diff --git a/contrib/benchmark/collect_ops.awk b/contrib/benchmark/collect_ops.awk
new file mode 100644
index 000000000..b34fcc723
--- /dev/null
+++ b/contrib/benchmark/collect_ops.awk
@@ -0,0 +1,45 @@
1# This file is part of GNUnet
2# Copyright (C) 2018 GNUnet e.V.
3#
4# GNUnet is free software: you can redistribute it and/or modify it
5# under the terms of the GNU Affero General Public License as published
6# by the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# GNUnet is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18# Aggregate benchmarking data from multiple threads/processes
19# generated by util/benchmark.c.
20#
21# Can be used as
22# awk -f collect_ops.awk gnunet-benchmark-ops-*.txt
23
24
25# records are of the following form:
26# op <op> count <count> time_us <time_us>
27{
28 op[$2]["count"] += $4;
29 op[$2]["time_us"] += $6;
30}
31
32function avg(s, c) {
33 if (c == 0) {
34 return 0;
35 } else {
36 return s / c;
37 }
38}
39
40END {
41 for (x in op) {
42 print "op", x, "count", op[x]["count"], "time_us", op[x]["time_us"], \
43 "time_avg_us", avg(op[x]["time_us"], op[x]["count"]);
44 }
45}
diff --git a/contrib/benchmark/collect_urls.awk b/contrib/benchmark/collect_urls.awk
new file mode 100644
index 000000000..27424b2b8
--- /dev/null
+++ b/contrib/benchmark/collect_urls.awk
@@ -0,0 +1,47 @@
1# records are of the following form:
2# This file is part of GNUnet
3# Copyright (C) 2018 GNUnet e.V.
4#
5# GNUnet is free software: you can redistribute it and/or modify it
6# under the terms of the GNU Affero General Public License as published
7# by the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# GNUnet is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Affero General Public License for more details.
14#
15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19# Aggregate benchmarking data from multiple threads/processes
20# generated by util/benchmark.c.
21#
22# Can be used as
23# awk -f collect_ops.awk gnunet-benchmark-ops-*.txt
24# url <url> status <status> count <count> time_us <time_us>
25
26{
27 url[$2][$4]["count"] += $6;
28 url[$2][$4]["time_us"] += $8;
29}
30
31function avg(s, c) {
32 if (c == 0) {
33 return 0;
34 } else {
35 return s / c;
36 }
37}
38
39END {
40 for (x in url) {
41 for (y in url[x]) {
42 print "url", x, "status", y, \
43 "count", url[x][y]["count"], "time_us", url[x][y]["time_us"], \
44 "time_avg_us", avg(url[x][y]["time_us"], url[x][y]["count"]);
45 }
46 }
47}