aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/perf_datastore_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-06-17 02:50:43 +0000
committerChristian Grothoff <christian@grothoff.org>2009-06-17 02:50:43 +0000
commit440bab102fc945dd51bd98f07e25f9375f58fa21 (patch)
tree7acd470a20d934ab0638aba602b1f5c0918d81a8 /src/datastore/perf_datastore_api.c
parent4ac29e4a039e4f403a03f3bfb959c1bef4501846 (diff)
downloadgnunet-440bab102fc945dd51bd98f07e25f9375f58fa21.tar.gz
gnunet-440bab102fc945dd51bd98f07e25f9375f58fa21.zip
making tests compile
Diffstat (limited to 'src/datastore/perf_datastore_api.c')
-rw-r--r--src/datastore/perf_datastore_api.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 7b3b6cfff..95ee18dad 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -31,14 +31,6 @@
31 * strategy alternates between "lowest priority" and "earliest expiration". 31 * strategy alternates between "lowest priority" and "earliest expiration".
32 * Priorities and expiration dates are set using a pseudo-random value 32 * Priorities and expiration dates are set using a pseudo-random value
33 * within a realistic range. 33 * within a realistic range.
34 * <p>
35 *
36 * Note that the disk overhead calculations are not very sane for
37 * MySQL: we take the entire /var/lib/mysql directory (best we can
38 * do for ISAM), which may contain other data and which never
39 * shrinks. The scanning of the entire mysql directory during
40 * each report is also likely to be the cause of a minor
41 * slowdown compared to sqlite.<p>
42 */ 34 */
43 35
44#include "platform.h" 36#include "platform.h"
@@ -103,13 +95,6 @@ static struct GNUNET_DATASTORE_Handle *datastore;
103 */ 95 */
104#define ITERATIONS 100 96#define ITERATIONS 100
105 97
106/**
107 * Name of the database on disk.
108 * You may have to adjust this path and the access
109 * permission to the respective directory in order
110 * to obtain all of the performance information.
111 */
112#define DB_NAME "/tmp/gnunet-datastore-test/data/fs/"
113 98
114static unsigned long long stored_bytes; 99static unsigned long long stored_bytes;
115 100
@@ -186,12 +171,12 @@ run (void *cls,
186{ 171{
187 int j; 172 int j;
188 unsigned long long size; 173 unsigned long long size;
189 int have_file;
190 struct stat sbuf;
191 int i; 174 int i;
192 175
193 datastore = GNUNET_DATASTORE_connect (cfg, sched); 176 datastore = GNUNET_DATASTORE_connect (cfg, sched);
194 have_file = 0 == stat (DB_NAME, &sbuf); 177 /* FIXME: change loop to use CPS; current
178 datastore API will likely react negative to
179 us ignoring the callbacks... */
195 for (i = 0; i < ITERATIONS; i++) 180 for (i = 0; i < ITERATIONS; i++)
196 { 181 {
197#if REPORT_ID 182#if REPORT_ID
@@ -205,22 +190,15 @@ run (void *cls,
205 if ((i % 2) == 0) 190 if ((i % 2) == 0)
206 GNUNET_DATASTORE_get_random (datastore, &iterate_delete, NULL); 191 GNUNET_DATASTORE_get_random (datastore, &iterate_delete, NULL);
207 size = 0; 192 size = 0;
208 if (have_file)
209 GNUNET_disk_file_size (NULL, DB_NAME, &size, GNUNET_NO);
210 printf ( 193 printf (
211#if REPORT_ID 194#if REPORT_ID
212 "\n" 195 "\n"
213#endif 196#endif
214 "Useful %llu, disk %llu (%.2f%%) / %lluk ops / %llu ops/s\n", 197 "Stored %llu kB / %lluk ops / %llu ops/s\n",
215 stored_bytes / 1024, /* used size in k */ 198 stored_bytes / 1024, /* used size in k */
216 size / 1024, /* disk size in kb */
217 (100.0 * size / stored_bytes) - 100, /* overhead */
218 (stored_ops * 2 - stored_entries) / 1024, /* total operations (in k) */ 199 (stored_ops * 2 - stored_entries) / 1024, /* total operations (in k) */
219 1000 * (stored_ops * 2 - stored_entries) / (1 + GNUNET_get_time () - start_time)); /* operations per second */ 200 1000 * (stored_ops * 2 - stored_entries) / (1 + GNUNET_TIME_absolute_get_duration(start_time).value)); /* operations per second */
220 if (GNUNET_shutdown_test () == GNUNET_YES)
221 break;
222 } 201 }
223
224 GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); 202 GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
225} 203}
226 204
@@ -246,7 +224,7 @@ check ()
246#if VERBOSE 224#if VERBOSE
247 "-L", "DEBUG", 225 "-L", "DEBUG",
248#endif 226#endif
249 "-c", "perf_datastore_api_data.conf", NULL); 227 "-c", "test_datastore_api_data.conf", NULL);
250 sleep (1); 228 sleep (1);
251 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 229 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
252 argv, "perf-datastore-api", "nohelp", 230 argv, "perf-datastore-api", "nohelp",
@@ -281,7 +259,4 @@ main (int argc, char *argv[])
281} 259}
282 260
283 261
284
285
286
287/* end of perf_datastore_api.c */ 262/* end of perf_datastore_api.c */