diff options
Diffstat (limited to 'src/util/benchmark.h')
-rw-r--r-- | src/util/benchmark.h | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/util/benchmark.h b/src/util/benchmark.h index eec9c9c8a..ec00cb0d3 100644 --- a/src/util/benchmark.h +++ b/src/util/benchmark.h | |||
@@ -28,9 +28,48 @@ | |||
28 | #include "gnunet_time_lib.h" | 28 | #include "gnunet_time_lib.h" |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Maximum length of URLs considered for benchmarking. | ||
32 | * Shorter URLs are simply truncated. | ||
33 | */ | ||
34 | #define MAX_BENCHMARK_URL_LEN 128 | ||
35 | |||
36 | |||
37 | /** | ||
38 | * Struct for benchmark data for one URL. | ||
39 | */ | ||
40 | struct UrlRequestData | ||
41 | { | ||
42 | /** | ||
43 | * Request URL, truncated (but 0-terminated). | ||
44 | */ | ||
45 | char request_url[MAX_BENCHMARK_URL_LEN]; | ||
46 | |||
47 | /** | ||
48 | * How often was the URL requested? | ||
49 | */ | ||
50 | uint64_t count; | ||
51 | |||
52 | /** | ||
53 | * Total time spent requesting this URL. | ||
54 | */ | ||
55 | struct GNUNET_TIME_Relative time; | ||
56 | |||
57 | /** | ||
58 | * Slowest time to response. | ||
59 | */ | ||
60 | struct GNUNET_TIME_Relative time_max; | ||
61 | |||
62 | /** | ||
63 | * Fastest time to response. | ||
64 | */ | ||
65 | struct GNUNET_TIME_Relative time_min; | ||
66 | }; | ||
67 | |||
68 | /** | ||
31 | * Thread-local struct for benchmarking data. | 69 | * Thread-local struct for benchmarking data. |
32 | */ | 70 | */ |
33 | struct BenchmarkData { | 71 | struct BenchmarkData |
72 | { | ||
34 | /** | 73 | /** |
35 | * Number of eddsa_sign operations. | 74 | * Number of eddsa_sign operations. |
36 | */ | 75 | */ |
@@ -40,6 +79,12 @@ struct BenchmarkData { | |||
40 | * Time spent in eddsa_sign. | 79 | * Time spent in eddsa_sign. |
41 | */ | 80 | */ |
42 | struct GNUNET_TIME_Relative eddsa_sign_time; | 81 | struct GNUNET_TIME_Relative eddsa_sign_time; |
82 | |||
83 | struct UrlRequestData *urd; | ||
84 | |||
85 | unsigned int urd_len; | ||
86 | |||
87 | unsigned int urd_capacity; | ||
43 | }; | 88 | }; |
44 | 89 | ||
45 | 90 | ||
@@ -52,4 +97,13 @@ struct BenchmarkData { | |||
52 | struct BenchmarkData * | 97 | struct BenchmarkData * |
53 | get_benchmark_data (void); | 98 | get_benchmark_data (void); |
54 | 99 | ||
100 | /** | ||
101 | * Get benchmark data for a URL. If the URL is too long, it's truncated | ||
102 | * before looking up the correspoding benchmark data. | ||
103 | * | ||
104 | * @param url url to get request data for | ||
105 | */ | ||
106 | struct UrlRequestData * | ||
107 | get_url_benchmark_data (char *url); | ||
108 | |||
55 | #endif /* BENCHMARK_H_ */ | 109 | #endif /* BENCHMARK_H_ */ |