This commit is contained in:
Fournier Nicolas 2015-07-07 12:57:14 +02:00
parent a7d8984671
commit b7e2e10712
2 changed files with 59 additions and 41 deletions

View File

@ -45,20 +45,19 @@ main (int argc, char ** argv)
struct PERF_TALER_MINTDB_Cmd benchmark[] = struct PERF_TALER_MINTDB_Cmd benchmark[] =
{ {
// Denomination used to create coins // Denomination used to create coins
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("00 - Start of interpreter"), PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Initializing database"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
NB_DENOMINATION_INIT), NB_DENOMINATION_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("01 - start transaction"), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"), PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("01 - commit transaction"), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
"01 - denomination loop", "01 - denomination loop",
"01 - denomination", "01 - denomination",
NB_DENOMINATION_SAVE), NB_DENOMINATION_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - denomination loop end", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"01 - denomination loop"), "01 - denomination loop"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("01 - init denomination complete"),
// End of initialization // End of initialization
// Reserve initialization // Reserve initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
@ -68,14 +67,13 @@ main (int argc, char ** argv)
"02 - init reserve loop", "02 - init reserve loop",
"02 - reserve", "02 - reserve",
NB_RESERVE_SAVE), NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - init reserve end loop", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"02 - init reserve loop"), "02 - init reserve loop"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("02 - reserve init complete"),
// End reserve init // End reserve init
// Withdrawal initialization // Withdrawal initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop",
NB_WITHDRAW_INIT), NB_WITHDRAW_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("03 - start transaction"), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
"03 - init withdraw loop", "03 - init withdraw loop",
"01 - save denomination"), "01 - save denomination"),
@ -85,39 +83,59 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw", PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw",
"03 - denomination load", "03 - denomination load",
"03 - reserve load"), "03 - reserve load"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("03 - commit transaction"), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - blindcoin array", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - blindcoin array",
"03 - init withdraw loop", "03 - init withdraw loop",
"03 - withdraw", "03 - withdraw",
NB_WITHDRAW_SAVE), NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - withdraw init end loop", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"03 - init withdraw loop"), "03 - init withdraw loop"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("03 - withdraw init complete"),
//End of withdrawal initialization //End of withdrawal initialization
//Deposit initialization //Deposit initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop",
NB_DEPOSIT_INIT), NB_DEPOSIT_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("04 - start transaction"), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - denomination load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - denomination load",
"04 - deposit init loop", "04 - deposit init loop",
"01 - save denomination"), "01 - save denomination"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit", PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit",
"04 - denomination load"), "04 - denomination load"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("04 - commit transaction"), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
"04 - deposit init loop", "04 - deposit init loop",
"04 - deposit", "04 - deposit",
NB_DEPOSIT_SAVE), NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("04 - deposit init loop end", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"04 - deposit init loop"), "04 - deposit init loop"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("04 - deposit init complete"), PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
// End of deposit initialization // End of deposit initialization
PERF_TALER_MINTDB_INIT_CMD_END ("end"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - loop",
NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("05 - deposit",
"05 - loop",
"04 - deposit array"),
PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT ("",
""),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"05 - loop"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
"05 - start",
"05 - stop",
"deposit insertion",
"deposit/sec",
NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END (""),
}; };
ret = PERF_TALER_MINTDB_run_benchmark ("perf-taler-mintdb", ret = PERF_TALER_MINTDB_run_benchmark ("perf-taler-mintdb",
"./test-mint-db-postgres.conf", "./test-mint-db-postgres.conf",
NULL, (struct PERF_TALER_MINTDB_Cmd [])
{PERF_TALER_MINTDB_INIT_CMD_END("")},
benchmark); benchmark);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return 1; return 1;

View File

@ -449,8 +449,8 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
GAUGER ("MINTDB", GAUGER ("MINTDB",
state->cmd[state->i].details.gauger.description, state->cmd[state->i].details.gauger.description,
elapsed_ms / state->cmd[state->i].details.gauger.divide, ((1.0 * state->cmd[state->i].details.gauger.divide) / elapsed_ms) * 1000,
"milliseconds"); state->cmd[state->i].details.gauger.unit);
} }
break; break;
@ -505,17 +505,17 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT: case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
{ {
int source_index; int source_index;
struct TALER_MINTDB_Deposit *deposit; struct PERF_TALER_MINTDB_Data data;
GNUNET_assert (GNUNET_SYSERR != GNUNET_assert (GNUNET_SYSERR !=
(source_index = cmd_find (state->cmd, (source_index = cmd_find (state->cmd,
state->cmd[state->i] state->cmd[state->i]
.details.get_deposit.label_deposit))); .details.get_deposit.label_deposit)));
GNUNET_assert (NULL != data_copy (&state->cmd[source_index].exposed,
(deposit = state->cmd[source_index].exposed.data.deposit)); &data);
state->plugin->have_deposit (state->plugin->cls, state->plugin->have_deposit (state->plugin->cls,
state->session, state->session,
deposit); data.data.deposit);
} }
break; break;
@ -545,18 +545,18 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_RESERVE: case PERF_TALER_MINTDB_CMD_GET_RESERVE:
{ {
int reserve_index; int reserve_index;
struct TALER_MINTDB_Reserve *reserve; struct PERF_TALER_MINTDB_Data data;
GNUNET_assert (GNUNET_SYSERR != GNUNET_assert (GNUNET_SYSERR !=
(reserve_index = cmd_find (state->cmd, (reserve_index = cmd_find (state->cmd,
state->cmd[state->i] state->cmd[state->i]
.details.get_reserve.label_reserve))); .details.get_reserve.label_reserve)));
GNUNET_assert (NULL != data_copy (&state->cmd[reserve_index].exposed,
(reserve = state->cmd[reserve_index].exposed.data.reserve)); &data);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
(state->plugin->reserve_get (state->plugin->cls, (state->plugin->reserve_get (state->plugin->cls,
state->session, state->session,
reserve))); data.data.reserve)));
} }
break; break;
@ -564,18 +564,18 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{ {
int reserve_index; int reserve_index;
struct TALER_MINTDB_ReserveHistory *history; struct TALER_MINTDB_ReserveHistory *history;
struct TALER_MINTDB_Reserve *reserve; struct PERF_TALER_MINTDB_Data data;
GNUNET_assert (GNUNET_SYSERR != GNUNET_assert (GNUNET_SYSERR !=
(reserve_index = cmd_find (state->cmd, (reserve_index = cmd_find (state->cmd,
state->cmd[state->i] state->cmd[state->i]
.details.get_reserve_history.label_reserve))); .details.get_reserve_history.label_reserve)));
GNUNET_assert (NULL != data_copy (&state->cmd[reserve_index].exposed,
(reserve = state->cmd[reserve_index].exposed.data.reserve)); &data);
GNUNET_assert (NULL != GNUNET_assert (NULL !=
(history = state->plugin->get_reserve_history (state->plugin->cls, (history = state->plugin->get_reserve_history (state->plugin->cls,
state->session, state->session,
&reserve->pub))); &data.data.reserve->pub)));
state->plugin->free_reserve_history (state->plugin->cls, state->plugin->free_reserve_history (state->plugin->cls,
history); history);
} }
@ -597,18 +597,18 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION: case PERF_TALER_MINTDB_CMD_GET_DENOMINATION:
{ {
int source_index; int source_index;
struct TALER_MINTDB_DenominationKeyIssueInformation *dki; struct PERF_TALER_MINTDB_Data data;
GNUNET_assert (GNUNET_SYSERR != GNUNET_assert (GNUNET_SYSERR !=
(source_index = cmd_find (state->cmd, (source_index = cmd_find (state->cmd,
state->cmd[state->i] state->cmd[state->i]
.details.get_denomination.label_denom))); .details.get_denomination.label_denom)));
GNUNET_assert (NULL != data_copy (&state->cmd[source_index].exposed,
(dki = state->cmd[source_index].exposed.data.dki)); &data);
state->plugin->get_denomination_info (state->plugin->cls, state->plugin->get_denomination_info (state->plugin->cls,
state->session, state->session,
&dki->denom_pub, &data.data.dki->denom_pub,
&dki->issue); &data.data.dki->issue);
} }
break; break;
@ -641,18 +641,18 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_WITHDRAW: case PERF_TALER_MINTDB_CMD_GET_WITHDRAW:
{ {
int source_index; int source_index;
struct TALER_MINTDB_CollectableBlindcoin *blindcoin ; struct PERF_TALER_MINTDB_Data data;
GNUNET_assert (GNUNET_SYSERR != GNUNET_assert (GNUNET_SYSERR !=
(source_index = cmd_find (state->cmd, (source_index = cmd_find (state->cmd,
state->cmd[state->i] state->cmd[state->i]
.details.get_denomination.label_denom))); .details.get_denomination.label_denom)));
GNUNET_assert (NULL != data_copy (&state->cmd[source_index].exposed,
(blindcoin = state->cmd[source_index].exposed.data.blindcoin)); &data);
state->plugin->get_withdraw_info (state->plugin->cls, state->plugin->get_withdraw_info (state->plugin->cls,
state->session, state->session,
&blindcoin->h_coin_envelope, &data.data.blindcoin->h_coin_envelope,
blindcoin); data.data.blindcoin);
} }
break; break;