diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-24 16:35:09 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-24 16:35:21 +0200 |
commit | 91906b6f6a2639efc7e41623ade6b7b02f1e297c (patch) | |
tree | 7fc85f376f2af103af86c4b60070b91a677f6a67 /contrib/benchmark | |
parent | 0ce2284452e86e3fb6991e573bed2d37b0be8331 (diff) | |
download | gnunet-91906b6f6a2639efc7e41623ade6b7b02f1e297c.tar.gz gnunet-91906b6f6a2639efc7e41623ade6b7b02f1e297c.zip |
consolidate benchmark collection scripts
Diffstat (limited to 'contrib/benchmark')
-rw-r--r-- | contrib/benchmark/collect.awk (renamed from contrib/benchmark/collect_urls.awk) | 21 | ||||
-rw-r--r-- | contrib/benchmark/collect_ops.awk | 45 |
2 files changed, 16 insertions, 50 deletions
diff --git a/contrib/benchmark/collect_urls.awk b/contrib/benchmark/collect.awk index 27424b2b8..887886abf 100644 --- a/contrib/benchmark/collect_urls.awk +++ b/contrib/benchmark/collect.awk | |||
@@ -1,4 +1,3 @@ | |||
1 | # records are of the following form: | ||
2 | # This file is part of GNUnet | 1 | # This file is part of GNUnet |
3 | # Copyright (C) 2018 GNUnet e.V. | 2 | # Copyright (C) 2018 GNUnet e.V. |
4 | # | 3 | # |
@@ -20,12 +19,20 @@ | |||
20 | # generated by util/benchmark.c. | 19 | # generated by util/benchmark.c. |
21 | # | 20 | # |
22 | # Can be used as | 21 | # Can be used as |
23 | # awk -f collect_ops.awk gnunet-benchmark-ops-*.txt | 22 | # awk -f collect.awk gnunet-benchmark-{ops,urls}-*.txt |
24 | # url <url> status <status> count <count> time_us <time_us> | 23 | |
25 | 24 | ||
25 | # records are of the following forms: | ||
26 | # op <op> count <count> time_us <time_us> | ||
27 | # url <url> status <status> count <count> time_us <time_us> | ||
26 | { | 28 | { |
27 | url[$2][$4]["count"] += $6; | 29 | if ($1 == "op") { |
28 | url[$2][$4]["time_us"] += $8; | 30 | op[$2]["count"] += $4; |
31 | op[$2]["time_us"] += $6; | ||
32 | } else if ($1 == "url") { | ||
33 | url[$2][$4]["count"] += $6; | ||
34 | url[$2][$4]["time_us"] += $8; | ||
35 | } | ||
29 | } | 36 | } |
30 | 37 | ||
31 | function avg(s, c) { | 38 | function avg(s, c) { |
@@ -37,6 +44,10 @@ function avg(s, c) { | |||
37 | } | 44 | } |
38 | 45 | ||
39 | END { | 46 | END { |
47 | for (x in op) { | ||
48 | print "op", x, "count", op[x]["count"], "time_us", op[x]["time_us"], \ | ||
49 | "time_avg_us", avg(op[x]["time_us"], op[x]["count"]); | ||
50 | } | ||
40 | for (x in url) { | 51 | for (x in url) { |
41 | for (y in url[x]) { | 52 | for (y in url[x]) { |
42 | print "url", x, "status", y, \ | 53 | print "url", x, "status", y, \ |
diff --git a/contrib/benchmark/collect_ops.awk b/contrib/benchmark/collect_ops.awk deleted file mode 100644 index b34fcc723..000000000 --- a/contrib/benchmark/collect_ops.awk +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
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 | |||
32 | function avg(s, c) { | ||
33 | if (c == 0) { | ||
34 | return 0; | ||
35 | } else { | ||
36 | return s / c; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | END { | ||
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 | } | ||