From 10c56bcea05df9ac5a7036850039900fbe435e00 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 20 Mar 2020 02:36:50 +0100 Subject: improving benchmarking logic, including more timings --- src/testing/testing_api_cmd_withdraw.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/testing/testing_api_cmd_withdraw.c') diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index b2fc272e3..1ef341e0a 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -40,6 +40,12 @@ * How long do we wait AT LEAST if the exchange says the reserve is unknown? */ #define UNKNOWN_MIN_BACKOFF GNUNET_TIME_relative_multiply ( \ + GNUNET_TIME_UNIT_MILLISECONDS, 10) + +/** + * How long do we wait AT MOST if the exchange says the reserve is unknown? + */ +#define UNKNOWN_MAX_BACKOFF GNUNET_TIME_relative_multiply ( \ GNUNET_TIME_UNIT_MILLISECONDS, 100) /** @@ -103,6 +109,11 @@ struct WithdrawState */ struct GNUNET_TIME_Relative backoff; + /** + * Total withdraw backoff applied. + */ + struct GNUNET_TIME_Relative total_backoff; + /** * Expected HTTP response code to the request. */ @@ -193,6 +204,10 @@ reserve_withdraw_cb (void *cls, else ws->backoff = GNUNET_TIME_relative_max (UNKNOWN_MIN_BACKOFF, ws->backoff); + ws->backoff = GNUNET_TIME_relative_min (ws->backoff, + UNKNOWN_MAX_BACKOFF); + ws->total_backoff = GNUNET_TIME_relative_add (ws->total_backoff, + ws->backoff); ws->retry_task = GNUNET_SCHEDULER_add_delayed (ws->backoff, &do_retry, ws); @@ -224,6 +239,14 @@ reserve_withdraw_cb (void *cls, } ws->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_dup (sig->rsa_signature); + if (0 != ws->total_backoff.rel_value_us) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Total withdraw backoff for %s was %s\n", + is->commands[is->ip].label, + GNUNET_STRINGS_relative_time_to_string (ws->total_backoff, + GNUNET_YES)); + } break; case MHD_HTTP_FORBIDDEN: /* nothing to check */ -- cgit v1.2.3