aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-05-24 21:08:58 +0000
committerChristian Grothoff <christian@grothoff.org>2011-05-24 21:08:58 +0000
commit48197df156e707beed6c396b5248755ff82543a0 (patch)
tree412176881ad3bc0a43a29496ae76b1a3cd7bf3ba /src/datastore
parentdfd7759ebf34e5597830eca8b89256ec02900235 (diff)
downloadgnunet-48197df156e707beed6c396b5248755ff82543a0.tar.gz
gnunet-48197df156e707beed6c396b5248755ff82543a0.zip
fix performance metric
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/perf_datastore_api.c10
-rw-r--r--src/datastore/perf_plugin_datastore.c54
2 files changed, 33 insertions, 31 deletions
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 92a56846d..9d7755342 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -283,10 +283,14 @@ run_continuation (void *cls,
283 break; 283 break;
284 case RP_DONE: 284 case RP_DONE:
285 GNUNET_snprintf (gstr, sizeof (gstr), 285 GNUNET_snprintf (gstr, sizeof (gstr),
286 "PUT operations in %s-datastore", 286 "DATASTORE-%s",
287 plugin_name); 287 plugin_name);
288 if (crc->i == ITERATIONS) 288 if ( (crc->i == ITERATIONS) &&
289 GAUGER ("DATASTORE", gstr, 1000 * stored_ops / (1 + GNUNET_TIME_absolute_get_duration(start_time).rel_value), "op/s"); 289 (stored_ops > 0) )
290 GAUGER (gstr,
291 "PUT operation duration",
292 GNUNET_TIME_absolute_get_duration(start_time).rel_value / stored_ops,
293 "ms/operation");
290 GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); 294 GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
291 GNUNET_free (crc); 295 GNUNET_free (crc);
292 ok = 0; 296 ok = 0;
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 7a8a0d4cf..a231b8e64 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -185,7 +185,6 @@ iterate_zeros (void *cls,
185 crc->cnt++; 185 crc->cnt++;
186 if (crc->cnt == PUT_10 / 4 - 1) 186 if (crc->cnt == PUT_10 / 4 - 1)
187 { 187 {
188 char buf[256];
189 unsigned int bc; 188 unsigned int bc;
190 189
191 bc = 0; 190 bc = 0;
@@ -194,15 +193,15 @@ iterate_zeros (void *cls,
194 bc++; 193 bc++;
195 194
196 crc->end = GNUNET_TIME_absolute_get(); 195 crc->end = GNUNET_TIME_absolute_get();
197 GNUNET_snprintf (buf, sizeof (buf),
198 "Iteration over %u zero-anonymity items",
199 crc->cnt);
200 printf ("%s took %llu ms yielding %u/%u items\n", 196 printf ("%s took %llu ms yielding %u/%u items\n",
201 buf, 197 "Select random zero-anonymity item",
202 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 198 (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
203 bc, 199 bc,
204 crc->cnt); 200 crc->cnt);
205 GAUGER (category, buf, crc->end.abs_value - crc->start.abs_value, "ms"); 201 if (crc->cnt > 0)
202 GAUGER (category,
203 "Select random zero-anonymity item",
204 (crc->end.abs_value - crc->start.abs_value) / crc->cnt, "ms/item");
206 memset (hits, 0, sizeof (hits)); 205 memset (hits, 0, sizeof (hits));
207 crc->phase++; 206 crc->phase++;
208 crc->cnt = 0; 207 crc->cnt = 0;
@@ -235,7 +234,6 @@ expiration_get (void *cls,
235 crc->cnt++; 234 crc->cnt++;
236 if (PUT_10 <= crc->cnt) 235 if (PUT_10 <= crc->cnt)
237 { 236 {
238 char buf[256];
239 unsigned int bc; 237 unsigned int bc;
240 238
241 bc = 0; 239 bc = 0;
@@ -244,15 +242,16 @@ expiration_get (void *cls,
244 bc++; 242 bc++;
245 243
246 crc->end = GNUNET_TIME_absolute_get(); 244 crc->end = GNUNET_TIME_absolute_get();
247 GNUNET_snprintf (buf, sizeof (buf),
248 "Execution of %u expiration+deletion-GET requests",
249 PUT_10);
250 printf ("%s took %llu ms yielding %u/%u items\n", 245 printf ("%s took %llu ms yielding %u/%u items\n",
251 buf, 246 "Selecting and deleting by expiration",
252 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 247 (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
253 bc, 248 bc,
254 (unsigned int) PUT_10); 249 (unsigned int) PUT_10);
255 GAUGER (category, buf, crc->end.abs_value - crc->start.abs_value, "ms"); 250 if (crc->cnt > 0)
251 GAUGER (category,
252 "Selecting and deleting by expiration",
253 (crc->end.abs_value - crc->start.abs_value) / crc->cnt,
254 "ms/item");
256 memset (hits, 0, sizeof (hits)); 255 memset (hits, 0, sizeof (hits));
257 if (++crc->iter == ITERATIONS) 256 if (++crc->iter == ITERATIONS)
258 crc->phase++; 257 crc->phase++;
@@ -289,7 +288,6 @@ replication_get (void *cls,
289 crc->cnt++; 288 crc->cnt++;
290 if (PUT_10 <= crc->cnt) 289 if (PUT_10 <= crc->cnt)
291 { 290 {
292 char buf[256];
293 unsigned int bc; 291 unsigned int bc;
294 292
295 bc = 0; 293 bc = 0;
@@ -298,15 +296,16 @@ replication_get (void *cls,
298 bc++; 296 bc++;
299 297
300 crc->end = GNUNET_TIME_absolute_get(); 298 crc->end = GNUNET_TIME_absolute_get();
301 GNUNET_snprintf (buf, sizeof (buf),
302 "Execution of %u replication-GET requests",
303 PUT_10);
304 printf ("%s took %llu ms yielding %u/%u items\n", 299 printf ("%s took %llu ms yielding %u/%u items\n",
305 buf, 300 "Selecting random item for replication",
306 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 301 (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
307 bc, 302 bc,
308 (unsigned int) PUT_10); 303 (unsigned int) PUT_10);
309 GAUGER (category, buf, crc->end.abs_value - crc->start.abs_value, "ms"); 304 if (crc->cnt > 0)
305 GAUGER (category,
306 "Selecting random item for replication",
307 (crc->end.abs_value - crc->start.abs_value) / crc->cnt,
308 "ms/item");
310 memset (hits, 0, sizeof (hits)); 309 memset (hits, 0, sizeof (hits));
311 crc->phase++; 310 crc->phase++;
312 crc->offset = 0; 311 crc->offset = 0;
@@ -397,16 +396,15 @@ test (void *cls,
397 putValue (crc->api, j, crc->i); 396 putValue (crc->api, j, crc->i);
398 crc->end = GNUNET_TIME_absolute_get (); 397 crc->end = GNUNET_TIME_absolute_get ();
399 { 398 {
400 char buf[256]; 399 printf ("%s took %llu ms for %llu items\n",
401 400 "Storing an item",
402 GNUNET_snprintf (buf, sizeof (buf), 401 (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
403 "Execution of %u PUT requests", 402 PUT_10);
404 PUT_10); 403 if (PUT_10 > 0)
405 printf ("%s took %llu ms\n", 404 GAUGER (category,
406 buf, 405 "Storing an item",
407 (unsigned long long) (crc->end.abs_value - crc->start.abs_value)); 406 (crc->end.abs_value - crc->start.abs_value) / PUT_10,
408 GAUGER (category, 407 "ms/item");
409 buf, crc->end.abs_value - crc->start.abs_value, "ms");
410 } 408 }
411 crc->i++; 409 crc->i++;
412 crc->start = GNUNET_TIME_absolute_get (); 410 crc->start = GNUNET_TIME_absolute_get ();