diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-09-11 20:01:25 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-09-11 20:01:25 +0000 |
commit | 0851edaa204fa2098e85e0ef5a9cd550ff65fac0 (patch) | |
tree | 0eda1bb265c3925f693dffd5db0367c6c29b3412 /src/stream | |
parent | 48ea50123bc913b72a02293079f3f6d60af9c47d (diff) | |
download | gnunet-0851edaa204fa2098e85e0ef5a9cd550ff65fac0.tar.gz gnunet-0851edaa204fa2098e85e0ef5a9cd550ff65fac0.zip |
scaffolding
Diffstat (limited to 'src/stream')
-rw-r--r-- | src/stream/perf_stream_api.c | 100 |
1 files changed, 98 insertions, 2 deletions
diff --git a/src/stream/perf_stream_api.c b/src/stream/perf_stream_api.c index a805d62ab..818bbd1b6 100644 --- a/src/stream/perf_stream_api.c +++ b/src/stream/perf_stream_api.c | |||
@@ -63,13 +63,58 @@ struct ProgressMeter | |||
63 | char *startup_string; | 63 | char *startup_string; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | |||
67 | /** | ||
68 | * Steps in testing | ||
69 | */ | ||
70 | enum TestStep | ||
71 | { | ||
72 | /** | ||
73 | * Single hop loopback testing | ||
74 | */ | ||
75 | TEST_STEP_1_HOP, | ||
76 | |||
77 | /** | ||
78 | * Testing with 2 peers | ||
79 | */ | ||
80 | TEST_STEP_2_HOP, | ||
81 | |||
82 | /** | ||
83 | * Testing with 3 peers | ||
84 | */ | ||
85 | TEST_STEP_3_HOP | ||
86 | }; | ||
87 | |||
88 | /** | ||
89 | * Maximum size of the data which we will transfer during tests | ||
90 | */ | ||
66 | #define DATA_SIZE 65536 /* 64KB */ | 91 | #define DATA_SIZE 65536 /* 64KB */ |
67 | 92 | ||
93 | /** | ||
94 | * Random data block. Should generate data first | ||
95 | */ | ||
68 | static uint32_t data[DATA_SIZE / 4]; /* 64KB array */ | 96 | static uint32_t data[DATA_SIZE / 4]; /* 64KB array */ |
69 | 97 | ||
98 | /** | ||
99 | * Payload sizes to test each major test with | ||
100 | */ | ||
70 | static uint16_t payload_size[] = | 101 | static uint16_t payload_size[] = |
71 | { 20, 500, 2000, 7000, 13000, 25000, 56000, 64000 }; | 102 | { 20, 500, 2000, 7000, 13000, 25000, 56000, 64000 }; |
72 | 103 | ||
104 | /** | ||
105 | * Handle for the progress meter | ||
106 | */ | ||
107 | static struct ProgressMeter *meter; | ||
108 | |||
109 | /** | ||
110 | * Current step of testing | ||
111 | */ | ||
112 | static enum TestStep test_step; | ||
113 | |||
114 | /** | ||
115 | * Index for choosing payload size | ||
116 | */ | ||
117 | unsigned int payload_size_index; | ||
73 | 118 | ||
74 | /** | 119 | /** |
75 | * Create a meter to keep track of the progress of some task. | 120 | * Create a meter to keep track of the progress of some task. |
@@ -175,10 +220,61 @@ free_meter (struct ProgressMeter *meter) | |||
175 | 220 | ||
176 | 221 | ||
177 | /** | 222 | /** |
223 | * Initialize framework and start test | ||
224 | * | ||
225 | * @param cls closure | ||
226 | * @param cfg configuration of the peer that was started | ||
227 | * @param peer identity of the peer that was created | ||
228 | */ | ||
229 | static void | ||
230 | run (void *cls, | ||
231 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
232 | struct GNUNET_TESTING_Peer *peer) | ||
233 | { | ||
234 | GNUNET_break (0); | ||
235 | } | ||
236 | |||
237 | |||
238 | /** | ||
178 | * Main function | 239 | * Main function |
179 | */ | 240 | */ |
180 | int main (int argc, char **argv) | 241 | int main (int argc, char **argv) |
181 | { | 242 | { |
182 | PRINTF ("Performance measurements for STREAM\n"); | 243 | unsigned int count; |
183 | return 0; | 244 | int ret; |
245 | |||
246 | meter = create_meter ((sizeof (data) / 4), "Generating random data\n", GNUNET_YES); | ||
247 | for (count=0; count < (sizeof (data) / 4); count++) | ||
248 | { | ||
249 | data[count] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
250 | UINT32_MAX); | ||
251 | update_meter (meter); | ||
252 | } | ||
253 | reset_meter (meter); | ||
254 | free_meter (meter); | ||
255 | test_step = TEST_STEP_1_HOP; | ||
256 | for (payload_size_index = 0; | ||
257 | payload_size_index < (sizeof (payload_size) / sizeof (uint16_t)); | ||
258 | payload_size_index++) | ||
259 | { | ||
260 | ret = GNUNET_TESTING_peer_run ("test_stream_big", "test_stream_local.conf", | ||
261 | &run, NULL); | ||
262 | if (0 != ret) | ||
263 | break; | ||
264 | } | ||
265 | test_step = TEST_STEP_2_HOP; | ||
266 | for (payload_size_index = 0; | ||
267 | payload_size_index < (sizeof (payload_size) / sizeof (uint16_t)); | ||
268 | payload_size_index++) | ||
269 | { | ||
270 | /* Initialize testbed here */ | ||
271 | } | ||
272 | test_step = TEST_STEP_3_HOP; | ||
273 | for (payload_size_index = 0; | ||
274 | payload_size_index < (sizeof (payload_size) / sizeof (uint16_t)); | ||
275 | payload_size_index++) | ||
276 | { | ||
277 | /* Initialize testbed here */ | ||
278 | } | ||
279 | return ret; | ||
184 | } | 280 | } |