aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-20 18:54:47 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-20 18:54:47 +0200
commitf4d0fb91c3850eb69a3e25800518d974bc7ee1f7 (patch)
tree07c11e1085703448e737f1dc42795731115e03f0 /src/gns
parent88da23e56af5b9d18112e421f2ef9022d8b8157f (diff)
downloadgnunet-f4d0fb91c3850eb69a3e25800518d974bc7ee1f7.tar.gz
gnunet-f4d0fb91c3850eb69a3e25800518d974bc7ee1f7.zip
add logic to count concurrently active GNS requests
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gnunet-gns-benchmark.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c
index 3754eec09..574251c87 100644
--- a/src/gns/gnunet-gns-benchmark.c
+++ b/src/gns/gnunet-gns-benchmark.c
@@ -84,7 +84,7 @@ struct Request
84 * this struct (optimizing memory consumption by reducing 84 * this struct (optimizing memory consumption by reducing
85 * total number of allocations). 85 * total number of allocations).
86 */ 86 */
87 char *hostname; 87 const char *hostname;
88 88
89 /** 89 /**
90 * While we are fetching the record, the value is set to the 90 * While we are fetching the record, the value is set to the
@@ -176,6 +176,11 @@ static struct GNUNET_TIME_Relative request_delay;
176 */ 176 */
177static struct GNUNET_TIME_Relative timeout; 177static struct GNUNET_TIME_Relative timeout;
178 178
179/**
180 * Number of requests we have concurrently active.
181 */
182static unsigned int active_cnt;
183
179 184
180/** 185/**
181 * Free @a req and data structures reachable from it. 186 * Free @a req and data structures reachable from it.
@@ -210,6 +215,7 @@ process_result (void *cls,
210 (void) gns_tld; 215 (void) gns_tld;
211 (void) rd_count; 216 (void) rd_count;
212 (void) rd; 217 (void) rd;
218 active_cnt--;
213 req->lr = NULL; 219 req->lr = NULL;
214 req->latency = GNUNET_TIME_absolute_get_duration (req->op_start_time); 220 req->latency = GNUNET_TIME_absolute_get_duration (req->op_start_time);
215 GNUNET_CONTAINER_DLL_remove (act_head, 221 GNUNET_CONTAINER_DLL_remove (act_head,
@@ -244,11 +250,14 @@ process_queue (void *cls)
244 duration = GNUNET_TIME_absolute_get_duration (req->op_start_time); 250 duration = GNUNET_TIME_absolute_get_duration (req->op_start_time);
245 if (duration.rel_value_us < timeout.rel_value_us) 251 if (duration.rel_value_us < timeout.rel_value_us)
246 break; 252 break;
247 GNUNET_GNS_lookup_with_tld_cancel (req->lr);
248 GNUNET_CONTAINER_DLL_remove (act_head, 253 GNUNET_CONTAINER_DLL_remove (act_head,
249 act_tail, 254 act_tail,
250 req); 255 req);
256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
257 "Failing request `%s' due to timeout\n",
258 req->hostname);
251 failures[req->cat]++; 259 failures[req->cat]++;
260 active_cnt--;
252 free_request (req); 261 free_request (req);
253 } 262 }
254 if (NULL == (req = todo_head)) 263 if (NULL == (req = todo_head))
@@ -274,7 +283,12 @@ process_queue (void *cls)
274 act_tail, 283 act_tail,
275 req); 284 req);
276 lookups[req->cat]++; 285 lookups[req->cat]++;
286 active_cnt++;
277 req->op_start_time = GNUNET_TIME_absolute_get (); 287 req->op_start_time = GNUNET_TIME_absolute_get ();
288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
289 "Starting request `%s' (%u in parallel)\n",
290 req->hostname,
291 active_cnt);
278 req->lr = GNUNET_GNS_lookup_with_tld (gns, 292 req->lr = GNUNET_GNS_lookup_with_tld (gns,
279 req->hostname, 293 req->hostname,
280 GNUNET_GNSRECORD_TYPE_ANY, 294 GNUNET_GNSRECORD_TYPE_ANY,