aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-08-06 17:19:11 +0200
committerChristian Grothoff <christian@grothoff.org>2015-08-06 17:19:11 +0200
commit94ffa282b7bacbf452a3fb6480e07b68f32a3bca (patch)
tree3a852d5f41b21f7cfa1cdb86a07c066f96e8c728 /src
parentc4f75cfc1b4b558c13befc281cecb52051b345b3 (diff)
-minor style fixes in benchmarking logic
Diffstat (limited to 'src')
-rw-r--r--src/mintdb/perf_taler_mintdb.c17
-rw-r--r--src/mintdb/perf_taler_mintdb_init.c25
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c13
3 files changed, 26 insertions, 29 deletions
diff --git a/src/mintdb/perf_taler_mintdb.c b/src/mintdb/perf_taler_mintdb.c
index 6ea097c50..36fec5517 100644
--- a/src/mintdb/perf_taler_mintdb.c
+++ b/src/mintdb/perf_taler_mintdb.c
@@ -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),
diff --git a/src/mintdb/perf_taler_mintdb_init.c b/src/mintdb/perf_taler_mintdb_init.c
index 725b3be07..1968307b2 100644
--- a/src/mintdb/perf_taler_mintdb_init.c
+++ b/src/mintdb/perf_taler_mintdb_init.c
@@ -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);
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index 9882b830d..d2d7e6f4b 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -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,