-minor style fixes in benchmarking logic

This commit is contained in:
Christian Grothoff 2015-08-06 17:19:11 +02:00
parent c4f75cfc1b
commit 94ffa282b7
3 changed files with 26 additions and 29 deletions

View File

@ -25,14 +25,17 @@
#define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15
#define NB_RESERVE_INIT 10000
#define NB_RESERVE_SAVE 1000
#define BIGGER 10
#define BIG 4
#define NB_DEPOSIT_INIT 10000
#define NB_DEPOSIT_SAVE 1000
#define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG
#define NB_WITHDRAW_INIT 10000
#define NB_WITHDRAW_SAVE 1000
#define NB_DEPOSIT_INIT BIGGER
#define NB_DEPOSIT_SAVE BIG
#define NB_WITHDRAW_INIT BIGGER
#define NB_WITHDRAW_SAVE BIG
/**
* Runs the performances tests for the mint database
@ -255,7 +258,7 @@ main (int argc, char ** argv)
"item/sec",
NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of /withdraw/sign"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - start"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("12 - /deposit",
NB_DEPOSIT_SAVE),

View File

@ -346,9 +346,9 @@ PERF_TALER_MINTDB_coin_init (
/* public_info */
GNUNET_CRYPTO_eddsa_key_get_public (&coin->priv,
&coin->public_info.coin_pub.eddsa_pub);
coin->public_info.denom_pub.rsa_public_key =
coin->public_info.denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key);
coin->public_info.denom_sig.rsa_signature =
coin->public_info.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_sign (dki->denom_priv.rsa_private_key,
&coin->public_info.coin_pub,
sizeof (struct TALER_CoinSpendPublicKeyP));
@ -356,9 +356,9 @@ PERF_TALER_MINTDB_coin_init (
GNUNET_assert (NULL != coin->public_info.denom_sig.rsa_signature);
/* blind */
coin->blind.sig.rsa_signature =
coin->blind.sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->public_info.denom_sig.rsa_signature);
coin->blind.denom_pub.rsa_public_key =
coin->blind.denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key);
GNUNET_assert (NULL != coin->blind.sig.rsa_signature);
GNUNET_assert (NULL != coin->blind.denom_pub.rsa_public_key);
@ -376,6 +376,7 @@ PERF_TALER_MINTDB_coin_init (
/**
* Copies the given coin
*
* @param coin the coin to copy
* @return a copy of coin; NULL if error
*/
@ -385,25 +386,20 @@ PERF_TALER_MINTDB_coin_copy (const struct PERF_TALER_MINTDB_Coin *coin)
struct PERF_TALER_MINTDB_Coin *copy;
copy = GNUNET_new (struct PERF_TALER_MINTDB_Coin);
GNUNET_assert (NULL != copy);
/* priv */
copy->priv = coin->priv;
/* public_info */
copy->public_info.coin_pub = coin->public_info.coin_pub;
copy->public_info.denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_public_key_dup (coin->public_info.denom_pub.rsa_public_key);
GNUNET_assert (NULL != copy->public_info.denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_public_key_dup (coin->public_info.denom_pub.rsa_public_key);
copy->public_info.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->public_info.denom_sig.rsa_signature);
GNUNET_assert (NULL != coin->public_info.denom_sig.rsa_signature);
/* blind */
copy->blind.sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->blind.sig.rsa_signature);
GNUNET_assert (NULL != copy->blind.sig.rsa_signature);
GNUNET_CRYPTO_rsa_signature_dup (coin->blind.sig.rsa_signature);
copy->blind.denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_public_key_dup (coin->blind.denom_pub.rsa_public_key);
GNUNET_assert (NULL != copy->blind.denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_public_key_dup (coin->blind.denom_pub.rsa_public_key);
copy->blind.amount_with_fee = coin->blind.amount_with_fee;
copy->blind.withdraw_fee = coin->blind.withdraw_fee;
copy->blind.reserve_pub = coin->blind.reserve_pub;
@ -415,7 +411,8 @@ PERF_TALER_MINTDB_coin_copy (const struct PERF_TALER_MINTDB_Coin *coin)
/**
* Liberate memory of @a coin
* Free memory of @a coin
*
* @param coin pointer to the structure to free
*/
int
@ -538,7 +535,7 @@ PERF_TALER_MINTDB_refresh_melt_copy (const struct TALER_MINTDB_RefreshMelt *melt
copy = GNUNET_new (struct TALER_MINTDB_RefreshMelt);
*copy = *melt;
copy->coin.denom_sig.rsa_signature =
copy->coin.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (melt->coin.denom_sig.rsa_signature);
GNUNET_assert (NULL != copy->coin.denom_sig.rsa_signature);

View File

@ -248,10 +248,10 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
}
cmd[i].details.save_array.index_loop = ret;
GNUNET_assert (NULL == cmd[i].details.save_array.data_saved);
cmd[i].details.save_array.data_saved =
GNUNET_new_array (cmd[i].details.save_array.nb_saved,
struct PERF_TALER_MINTDB_Data);
GNUNET_assert (NULL != cmd[i].details.save_array.data_saved);
cmd[i].details.save_array.data_saved[0].type =
cmd[cmd[i].details.save_array.index_save].exposed.type;
}
@ -700,7 +700,7 @@ interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
{
cmd->details.save_array.index = 0;
}
/* The probobility distribution of the saved items will be a little biased
/* The probability distribution of the saved items will be a little biased
against the few last items but it should not be a big problem. */
selection_chance = loop_ref->details.loop.max_iterations /
cmd->details.save_array.nb_saved;
@ -1240,18 +1240,15 @@ PERF_TALER_MINTDB_interpret (struct TALER_MINTDB_Plugin *db_plugin,
struct PERF_TALER_MINTDB_interpreter_state state =
{.i = 0, .cmd = cmd, .plugin = db_plugin};
ret = cmd_init (state.cmd);
ret = cmd_init (cmd);
if (GNUNET_SYSERR == ret)
return ret;
state.session = db_plugin->get_session (db_plugin->cls,
GNUNET_YES);
GNUNET_assert (NULL != state.session);
ret = interpret (&state);
if (GNUNET_SYSERR == ret)
return ret;
cmd_clean (cmd);
return GNUNET_OK;
return ret;
}
@ -1263,7 +1260,7 @@ PERF_TALER_MINTDB_interpret (struct TALER_MINTDB_Plugin *db_plugin,
* @param init the commands to use for the database initialisation,
* if #NULL the standard initialization is used
* @param benchmark the commands for the benchmark
* @return #GNUNET_OK upon success; GNUNET_SYSERR upon failure
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
int
PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,