aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-04 14:20:33 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-04 14:20:33 +0000
commit900cc413d1504f62fa5bcd55058c7bef91e40993 (patch)
treec63607b115e191455254ddb7f5a3e39d99f44d62 /src/datastore
parentae64def363d4eeeaf8acfe586f00ae962da479fb (diff)
downloadgnunet-900cc413d1504f62fa5bcd55058c7bef91e40993.tar.gz
gnunet-900cc413d1504f62fa5bcd55058c7bef91e40993.zip
rewriting perf test to match new API --- now it fails...
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/perf_datastore_api.c69
1 files changed, 16 insertions, 53 deletions
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 3b89ad233..f8d68a37a 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -99,10 +99,6 @@ struct CpsRunContext
99 int j; 99 int j;
100 unsigned long long size; 100 unsigned long long size;
101 int i; 101 int i;
102
103 GNUNET_HashCode key;
104 size_t esize;
105 char data[65536];
106}; 102};
107 103
108 104
@@ -165,33 +161,11 @@ remove_next(void *cls,
165 fprintf (stderr, "D"); 161 fprintf (stderr, "D");
166#endif 162#endif
167 GNUNET_assert (GNUNET_OK == success); 163 GNUNET_assert (GNUNET_OK == success);
168 GNUNET_SCHEDULER_add_continuation (&run_continuation, 164 GNUNET_SCHEDULER_add_now (&run_continuation,
169 crc, 165 crc);
170 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
171}
172
173
174
175static void
176do_delete (void *cls,
177 const struct GNUNET_SCHEDULER_TaskContext *tc)
178{
179 struct CpsRunContext *crc = cls;
180
181 stored_bytes -= crc->esize;
182 stored_entries--;
183 stored_ops++;
184 GNUNET_DATASTORE_remove (datastore,
185 &crc->key,
186 crc->esize,
187 crc->data,
188 1, 1, TIMEOUT,
189 &remove_next,
190 crc);
191} 166}
192 167
193 168
194
195static void 169static void
196delete_value (void *cls, 170delete_value (void *cls,
197 const GNUNET_HashCode * key, 171 const GNUNET_HashCode * key,
@@ -204,32 +178,22 @@ delete_value (void *cls,
204 expiration, uint64_t uid) 178 expiration, uint64_t uid)
205{ 179{
206 struct CpsRunContext *crc = cls; 180 struct CpsRunContext *crc = cls;
207 181
208 if (key == NULL) 182 GNUNET_assert (NULL != key);
209 { 183 stored_ops++;
210 if (stored_bytes < MAX_SIZE) 184 stored_bytes -= size;
211 { 185 stored_entries--;
212 crc->phase = RP_REPORT;
213 GNUNET_SCHEDULER_add_continuation (&run_continuation,
214 crc,
215 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
216 return;
217 }
218 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_HIGH,
219 &do_delete,
220 crc);
221 return;
222 }
223 stored_ops++; 186 stored_ops++;
224 if (stored_bytes < MAX_SIZE) 187 if (stored_bytes < MAX_SIZE)
225 { 188 crc->phase = RP_PUT;
226 GNUNET_DATASTORE_iterate_get_next (datastore); 189 GNUNET_assert (NULL !=
227 return; 190 GNUNET_DATASTORE_remove (datastore,
228 } 191 key,
229 crc->key = *key; 192 size,
230 crc->esize = size; 193 data,
231 memcpy (crc->data, data, size); 194 1, 1, TIMEOUT,
232 GNUNET_DATASTORE_iterate_get_next (datastore); 195 &remove_next,
196 crc));
233} 197}
234 198
235 199
@@ -315,7 +279,6 @@ run_continuation (void *cls,
315} 279}
316 280
317 281
318
319static void 282static void
320run_tests (void *cls, 283run_tests (void *cls,
321 int success, 284 int success,