benchmark: variable 'refresh rate'

This commit is contained in:
Florian Dold 2018-10-02 21:08:59 +02:00
parent b7bbc4cc70
commit 34f12d3f06
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -49,11 +49,6 @@ enum BenchmarkError {
}; };
/**
* Probability that a spent coin will be refreshed.
*/
#define REFRESH_PROBABILITY 0.1
/** /**
* The whole benchmark is a repetition of a "unit". Each * The whole benchmark is a repetition of a "unit". Each
* unit is a array containing a withdraw+deposit operation, * unit is a array containing a withdraw+deposit operation,
@ -154,6 +149,11 @@ static unsigned int howmany_coins = 1;
*/ */
static unsigned int howmany_reserves = 1; static unsigned int howmany_reserves = 1;
/**
* Probability (in percent) of refreshing per spent coin.
*/
static unsigned int refresh_rate = 10;
/** /**
* How many clients we want to create. * How many clients we want to create.
*/ */
@ -441,7 +441,7 @@ run (void *cls,
AMOUNT_1, AMOUNT_1,
MHD_HTTP_OK)); MHD_HTTP_OK));
if (eval_probability (REFRESH_PROBABILITY)) if (eval_probability (refresh_rate / 100.0))
{ {
char *melt_label; char *melt_label;
char *reveal_label; char *reveal_label;
@ -831,6 +831,11 @@ main (int argc,
"NRESERVES", "NRESERVES",
"How many reserves per client we should create", "How many reserves per client we should create",
&howmany_reserves), &howmany_reserves),
GNUNET_GETOPT_option_uint ('R',
"refresh-rate",
"RATE",
"Probability of refresh per coin (0-100)",
&refresh_rate),
GNUNET_GETOPT_option_string ('m', GNUNET_GETOPT_option_string ('m',
"mode", "mode",
"MODE", "MODE",
@ -1006,7 +1011,7 @@ main (int argc,
"Executed (Withdraw=%u, Deposit=%u, Refresh~=%5.2f) * Reserve=%u * Parallel=%u, operations in %s\n", "Executed (Withdraw=%u, Deposit=%u, Refresh~=%5.2f) * Reserve=%u * Parallel=%u, operations in %s\n",
howmany_coins, howmany_coins,
howmany_coins, howmany_coins,
(float) howmany_coins * REFRESH_PROBABILITY, (float) howmany_coins * (refresh_rate / 100.0),
howmany_reserves, howmany_reserves,
howmany_clients, howmany_clients,
GNUNET_STRINGS_relative_time_to_string GNUNET_STRINGS_relative_time_to_string