diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/util/benchmark.h | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/util/benchmark.h')
-rw-r--r-- | src/util/benchmark.h | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/src/util/benchmark.h b/src/util/benchmark.h index 6816b47af..f4eb32191 100644 --- a/src/util/benchmark.h +++ b/src/util/benchmark.h | |||
@@ -37,18 +37,22 @@ | |||
37 | 37 | ||
38 | #if ENABLE_BENCHMARK | 38 | #if ENABLE_BENCHMARK |
39 | #define BENCHMARK_START(opname) \ | 39 | #define BENCHMARK_START(opname) \ |
40 | struct GNUNET_TIME_Absolute _benchmark_ ## opname ## _start = GNUNET_TIME_absolute_get() | 40 | struct GNUNET_TIME_Absolute _benchmark_ ## opname ## _start = \ |
41 | GNUNET_TIME_absolute_get () | ||
41 | #define BENCHMARK_END(opname) do { \ | 42 | #define BENCHMARK_END(opname) do { \ |
42 | { \ | 43 | { \ |
43 | struct GNUNET_TIME_Absolute _benchmark_ ## opname ## _end = GNUNET_TIME_absolute_get(); \ | 44 | struct GNUNET_TIME_Absolute _benchmark_ ## opname ## _end = \ |
44 | struct BenchmarkData *bd = get_benchmark_data(); \ | 45 | GNUNET_TIME_absolute_get (); \ |
45 | bd->opname ## _count++; \ | 46 | struct BenchmarkData *bd = get_benchmark_data (); \ |
46 | bd->opname ## _time = \ | 47 | bd->opname ## _count++; \ |
47 | GNUNET_TIME_relative_add(bd->opname ## _time, \ | 48 | bd->opname ## _time = \ |
48 | GNUNET_TIME_absolute_get_difference(_benchmark_ ## opname ## _start, \ | 49 | GNUNET_TIME_relative_add (bd->opname ## _time, \ |
49 | _benchmark_ ## opname ## _end)); \ | 50 | GNUNET_TIME_absolute_get_difference ( \ |
50 | } \ | 51 | _benchmark_ ## opname ## _start, \ |
51 | } while (0) | 52 | _benchmark_ \ |
53 | ## opname ## _end)); \ | ||
54 | } \ | ||
55 | } while (0) | ||
52 | #else | 56 | #else |
53 | #define BENCHMARK_START(opname) do { } while (0) | 57 | #define BENCHMARK_START(opname) do { } while (0) |
54 | #define BENCHMARK_END(opname) do { } while (0) | 58 | #define BENCHMARK_END(opname) do { } while (0) |
@@ -58,7 +62,8 @@ | |||
58 | /** | 62 | /** |
59 | * Struct for benchmark data for one URL. | 63 | * Struct for benchmark data for one URL. |
60 | */ | 64 | */ |
61 | struct UrlRequestData { | 65 | struct UrlRequestData |
66 | { | ||
62 | /** | 67 | /** |
63 | * Request URL, truncated (but 0-terminated). | 68 | * Request URL, truncated (but 0-terminated). |
64 | */ | 69 | */ |
@@ -107,32 +112,33 @@ struct UrlRequestData { | |||
107 | /** | 112 | /** |
108 | * Thread-local struct for benchmarking data. | 113 | * Thread-local struct for benchmarking data. |
109 | */ | 114 | */ |
110 | struct BenchmarkData { | 115 | struct BenchmarkData |
111 | GNUNET_DECLARE_BENCHMARK_OP(ecc_ecdh); | 116 | { |
112 | GNUNET_DECLARE_BENCHMARK_OP(ecdh_eddsa); | 117 | GNUNET_DECLARE_BENCHMARK_OP (ecc_ecdh); |
113 | GNUNET_DECLARE_BENCHMARK_OP(ecdhe_key_create); | 118 | GNUNET_DECLARE_BENCHMARK_OP (ecdh_eddsa); |
114 | GNUNET_DECLARE_BENCHMARK_OP(ecdhe_key_get_public); | 119 | GNUNET_DECLARE_BENCHMARK_OP (ecdhe_key_create); |
115 | GNUNET_DECLARE_BENCHMARK_OP(ecdsa_ecdh); | 120 | GNUNET_DECLARE_BENCHMARK_OP (ecdhe_key_get_public); |
116 | GNUNET_DECLARE_BENCHMARK_OP(ecdsa_key_create); | 121 | GNUNET_DECLARE_BENCHMARK_OP (ecdsa_ecdh); |
117 | GNUNET_DECLARE_BENCHMARK_OP(ecdsa_key_get_public); | 122 | GNUNET_DECLARE_BENCHMARK_OP (ecdsa_key_create); |
118 | GNUNET_DECLARE_BENCHMARK_OP(ecdsa_sign); | 123 | GNUNET_DECLARE_BENCHMARK_OP (ecdsa_key_get_public); |
119 | GNUNET_DECLARE_BENCHMARK_OP(ecdsa_verify); | 124 | GNUNET_DECLARE_BENCHMARK_OP (ecdsa_sign); |
120 | GNUNET_DECLARE_BENCHMARK_OP(eddsa_ecdh); | 125 | GNUNET_DECLARE_BENCHMARK_OP (ecdsa_verify); |
121 | GNUNET_DECLARE_BENCHMARK_OP(eddsa_key_create); | 126 | GNUNET_DECLARE_BENCHMARK_OP (eddsa_ecdh); |
122 | GNUNET_DECLARE_BENCHMARK_OP(eddsa_key_get_public); | 127 | GNUNET_DECLARE_BENCHMARK_OP (eddsa_key_create); |
123 | GNUNET_DECLARE_BENCHMARK_OP(eddsa_sign); | 128 | GNUNET_DECLARE_BENCHMARK_OP (eddsa_key_get_public); |
124 | GNUNET_DECLARE_BENCHMARK_OP(eddsa_verify); | 129 | GNUNET_DECLARE_BENCHMARK_OP (eddsa_sign); |
125 | GNUNET_DECLARE_BENCHMARK_OP(hash); | 130 | GNUNET_DECLARE_BENCHMARK_OP (eddsa_verify); |
126 | GNUNET_DECLARE_BENCHMARK_OP(hash_context_finish); | 131 | GNUNET_DECLARE_BENCHMARK_OP (hash); |
127 | GNUNET_DECLARE_BENCHMARK_OP(hash_context_read); | 132 | GNUNET_DECLARE_BENCHMARK_OP (hash_context_finish); |
128 | GNUNET_DECLARE_BENCHMARK_OP(hash_context_start); | 133 | GNUNET_DECLARE_BENCHMARK_OP (hash_context_read); |
129 | GNUNET_DECLARE_BENCHMARK_OP(hkdf); | 134 | GNUNET_DECLARE_BENCHMARK_OP (hash_context_start); |
130 | GNUNET_DECLARE_BENCHMARK_OP(rsa_blind); | 135 | GNUNET_DECLARE_BENCHMARK_OP (hkdf); |
131 | GNUNET_DECLARE_BENCHMARK_OP(rsa_private_key_create); | 136 | GNUNET_DECLARE_BENCHMARK_OP (rsa_blind); |
132 | GNUNET_DECLARE_BENCHMARK_OP(rsa_private_key_get_public); | 137 | GNUNET_DECLARE_BENCHMARK_OP (rsa_private_key_create); |
133 | GNUNET_DECLARE_BENCHMARK_OP(rsa_sign_blinded); | 138 | GNUNET_DECLARE_BENCHMARK_OP (rsa_private_key_get_public); |
134 | GNUNET_DECLARE_BENCHMARK_OP(rsa_unblind); | 139 | GNUNET_DECLARE_BENCHMARK_OP (rsa_sign_blinded); |
135 | GNUNET_DECLARE_BENCHMARK_OP(rsa_verify); | 140 | GNUNET_DECLARE_BENCHMARK_OP (rsa_unblind); |
141 | GNUNET_DECLARE_BENCHMARK_OP (rsa_verify); | ||
136 | 142 | ||
137 | struct UrlRequestData *urd; | 143 | struct UrlRequestData *urd; |
138 | 144 | ||
@@ -151,7 +157,7 @@ struct BenchmarkData { | |||
151 | * @return benchmark data for the current thread | 157 | * @return benchmark data for the current thread |
152 | */ | 158 | */ |
153 | struct BenchmarkData * | 159 | struct BenchmarkData * |
154 | get_benchmark_data(void); | 160 | get_benchmark_data (void); |
155 | 161 | ||
156 | /** | 162 | /** |
157 | * Get benchmark data for a URL. If the URL is too long, it's truncated | 163 | * Get benchmark data for a URL. If the URL is too long, it's truncated |
@@ -163,6 +169,6 @@ get_benchmark_data(void); | |||
163 | * @param status http status code | 169 | * @param status http status code |
164 | */ | 170 | */ |
165 | struct UrlRequestData * | 171 | struct UrlRequestData * |
166 | get_url_benchmark_data(char *url, unsigned int status); | 172 | get_url_benchmark_data (char *url, unsigned int status); |
167 | 173 | ||
168 | #endif /* BENCHMARK_H_ */ | 174 | #endif /* BENCHMARK_H_ */ |