aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/perf_datacache.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
commit416c2f5a713b93ba689a8cd1e038682a53e6bc17 (patch)
tree987f51d9edfddc02afe1524df5e1156b920c71d4 /src/datacache/perf_datacache.c
parentfceec98e767bce7ad2c24dde73cdcf8837e04013 (diff)
downloadgnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.tar.gz
gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.zip
-LRN: use FPRINTF -- #2051
Diffstat (limited to 'src/datacache/perf_datacache.c')
-rw-r--r--src/datacache/perf_datacache.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 6fc0a7217..0f4fea419 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -71,8 +71,7 @@ run (void *cls, char *const *args, const char *cfgfile,
71 71
72 if (h == NULL) 72 if (h == NULL)
73 { 73 {
74 fprintf (stderr, 74 FPRINTF (stderr, "%s", "Failed to initialize datacache. Database likely not setup, skipping test.\n");
75 "Failed to initialize datacache. Database likely not setup, skipping test.\n");
76 return; 75 return;
77 } 76 }
78 exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS); 77 exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
@@ -81,15 +80,15 @@ run (void *cls, char *const *args, const char *cfgfile,
81 for (i = 0; i < ITERATIONS; i++) 80 for (i = 0; i < ITERATIONS; i++)
82 { 81 {
83 if (0 == i % (ITERATIONS / 80)) 82 if (0 == i % (ITERATIONS / 80))
84 fprintf (stderr, "."); 83 FPRINTF (stderr, "%s", ".");
85 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 84 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
86 ASSERT (GNUNET_OK == 85 ASSERT (GNUNET_OK ==
87 GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode), 86 GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode),
88 (const char *) &n, 1 + i % 16, exp)); 87 (const char *) &n, 1 + i % 16, exp));
89 k = n; 88 k = n;
90 } 89 }
91 fprintf (stderr, "\n"); 90 FPRINTF (stderr, "%s", "\n");
92 fprintf (stdout, "Stored %u items in %llums\n", ITERATIONS, 91 FPRINTF (stdout, "Stored %u items in %llums\n", ITERATIONS,
93 (unsigned long long) 92 (unsigned long long)
94 GNUNET_TIME_absolute_get_duration (start).rel_value); 93 GNUNET_TIME_absolute_get_duration (start).rel_value);
95 GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name); 94 GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name);
@@ -101,13 +100,13 @@ run (void *cls, char *const *args, const char *cfgfile,
101 for (i = 0; i < ITERATIONS; i++) 100 for (i = 0; i < ITERATIONS; i++)
102 { 101 {
103 if (0 == i % (ITERATIONS / 80)) 102 if (0 == i % (ITERATIONS / 80))
104 fprintf (stderr, "."); 103 FPRINTF (stderr, "%s", ".");
105 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 104 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
106 GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n); 105 GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n);
107 k = n; 106 k = n;
108 } 107 }
109 fprintf (stderr, "\n"); 108 FPRINTF (stderr, "%s", "\n");
110 fprintf (stdout, 109 FPRINTF (stdout,
111 "Found %u/%u items in %llums (%u were deleted during storage processing)\n", 110 "Found %u/%u items in %llums (%u were deleted during storage processing)\n",
112 found, ITERATIONS, 111 found, ITERATIONS,
113 (unsigned long long) 112 (unsigned long long)
@@ -169,7 +168,7 @@ main (int argc, char *argv[])
169 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 168 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
170 "perf-datacache", "nohelp", options, &run, NULL); 169 "perf-datacache", "nohelp", options, &run, NULL);
171 if (ok != 0) 170 if (ok != 0)
172 fprintf (stderr, "Missed some perfcases: %d\n", ok); 171 FPRINTF (stderr, "Missed some perfcases: %d\n", ok);
173 return ok; 172 return ok;
174} 173}
175 174