aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/perf_plugin_datastore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
commit3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch)
tree61ce41a52cd6e7232cead77818ef265993b2427e /src/datastore/perf_plugin_datastore.c
parent4a0398474db197abed243a123fb971fbeeffab4b (diff)
downloadgnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz
gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/datastore/perf_plugin_datastore.c')
-rw-r--r--src/datastore/perf_plugin_datastore.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 322ca26b2..657acc66b 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -115,7 +115,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
115 size = size - (size & 7); /* always multiple of 8 */ 115 size = size - (size & 7); /* always multiple of 8 */
116 116
117 /* generate random key */ 117 /* generate random key */
118 key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value; 118 key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value_us;
119 GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key); 119 GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
120 memset (value, i, size); 120 memset (value, i, size);
121 if (i > 255) 121 if (i > 255)
@@ -164,9 +164,10 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
164 hits[i / 8] |= (1 << (i % 8)); 164 hits[i / 8] |= (1 << (i % 8));
165 165
166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
167 "Found result %d type=%u, priority=%u, size=%u, expire=%llu\n", 167 "Found result %d type=%u, priority=%u, size=%u, expire=%s\n",
168 i, 168 i,
169 type, priority, size, (unsigned long long) expiration.abs_value); 169 type, priority, size,
170 GNUNET_STRINGS_absolute_time_to_string (expiration));
170 crc->cnt++; 171 crc->cnt++;
171 if (crc->cnt == PUT_10 / 4 - 1) 172 if (crc->cnt == PUT_10 / 4 - 1)
172 { 173 {
@@ -178,13 +179,15 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
178 bc++; 179 bc++;
179 180
180 crc->end = GNUNET_TIME_absolute_get (); 181 crc->end = GNUNET_TIME_absolute_get ();
181 printf ("%s took %llu ms yielding %u/%u items\n", 182 printf ("%s took %s yielding %u/%u items\n",
182 "Select random zero-anonymity item", 183 "Select random zero-anonymity item",
183 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 184 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start,
185 crc->end),
186 GNUNET_YES),
184 bc, crc->cnt); 187 bc, crc->cnt);
185 if (crc->cnt > 0) 188 if (crc->cnt > 0)
186 GAUGER (category, "Select random zero-anonymity item", 189 GAUGER (category, "Select random zero-anonymity item",
187 (crc->end.abs_value - crc->start.abs_value) / crc->cnt, 190 (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt,
188 "ms/item"); 191 "ms/item");
189 memset (hits, 0, sizeof (hits)); 192 memset (hits, 0, sizeof (hits));
190 crc->phase++; 193 crc->phase++;
@@ -220,13 +223,15 @@ expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
220 bc++; 223 bc++;
221 224
222 crc->end = GNUNET_TIME_absolute_get (); 225 crc->end = GNUNET_TIME_absolute_get ();
223 printf ("%s took %llu ms yielding %u/%u items\n", 226 printf ("%s took %s yielding %u/%u items\n",
224 "Selecting and deleting by expiration", 227 "Selecting and deleting by expiration",
225 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 228 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start,
229 crc->end),
230 GNUNET_YES),
226 bc, (unsigned int) PUT_10); 231 bc, (unsigned int) PUT_10);
227 if (crc->cnt > 0) 232 if (crc->cnt > 0)
228 GAUGER (category, "Selecting and deleting by expiration", 233 GAUGER (category, "Selecting and deleting by expiration",
229 (crc->end.abs_value - crc->start.abs_value) / crc->cnt, 234 (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt,
230 "ms/item"); 235 "ms/item");
231 memset (hits, 0, sizeof (hits)); 236 memset (hits, 0, sizeof (hits));
232 if (++crc->iter == ITERATIONS) 237 if (++crc->iter == ITERATIONS)
@@ -266,13 +271,15 @@ replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
266 bc++; 271 bc++;
267 272
268 crc->end = GNUNET_TIME_absolute_get (); 273 crc->end = GNUNET_TIME_absolute_get ();
269 printf ("%s took %llu ms yielding %u/%u items\n", 274 printf ("%s took %s yielding %u/%u items\n",
270 "Selecting random item for replication", 275 "Selecting random item for replication",
271 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 276 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start,
277 crc->end),
278 GNUNET_YES),
272 bc, (unsigned int) PUT_10); 279 bc, (unsigned int) PUT_10);
273 if (crc->cnt > 0) 280 if (crc->cnt > 0)
274 GAUGER (category, "Selecting random item for replication", 281 GAUGER (category, "Selecting random item for replication",
275 (crc->end.abs_value - crc->start.abs_value) / crc->cnt, 282 (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt,
276 "ms/item"); 283 "ms/item");
277 memset (hits, 0, sizeof (hits)); 284 memset (hits, 0, sizeof (hits));
278 crc->phase++; 285 crc->phase++;
@@ -359,12 +366,14 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
359 putValue (crc->api, j, crc->i); 366 putValue (crc->api, j, crc->i);
360 crc->end = GNUNET_TIME_absolute_get (); 367 crc->end = GNUNET_TIME_absolute_get ();
361 { 368 {
362 printf ("%s took %llu ms for %llu items\n", "Storing an item", 369 printf ("%s took %s for %llu items\n", "Storing an item",
363 (unsigned long long) (crc->end.abs_value - crc->start.abs_value), 370 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start,
371 crc->end),
372 GNUNET_YES),
364 PUT_10); 373 PUT_10);
365 if (PUT_10 > 0) 374 if (PUT_10 > 0)
366 GAUGER (category, "Storing an item", 375 GAUGER (category, "Storing an item",
367 (crc->end.abs_value - crc->start.abs_value) / PUT_10, 376 (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / PUT_10,
368 "ms/item"); 377 "ms/item");
369 } 378 }
370 crc->i++; 379 crc->i++;