added new benchmarks

This commit is contained in:
Fournier Nicolas 2015-08-10 18:12:27 +02:00
parent d6c1340bcd
commit 8791ce6a04
4 changed files with 188 additions and 41 deletions

View File

@ -25,8 +25,8 @@
#define NB_DENOMINATION_INIT 15 #define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15 #define NB_DENOMINATION_SAVE 15
#define BIGGER 10 #define BIGGER 100000
#define BIG 10 #define BIG 10000
#define NB_RESERVE_INIT BIGGER #define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG #define NB_RESERVE_SAVE BIG
@ -37,6 +37,9 @@
#define NB_WITHDRAW_INIT BIGGER #define NB_WITHDRAW_INIT BIGGER
#define NB_WITHDRAW_SAVE BIG #define NB_WITHDRAW_SAVE BIG
#define NB_REFRESH_INIT BIGGER
#define NB_REFRESH_SAVE BIG
/** /**
* Runs the performances tests for the mint database * Runs the performances tests for the mint database
* and logs the results using Gauger * and logs the results using Gauger
@ -118,8 +121,21 @@ main (int argc, char ** argv)
NB_DEPOSIT_SAVE), NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"04 - deposit init loop"), "04 - deposit init loop"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
// End of deposit initialization // End of deposit initialization
// Session initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - refresh session init loop",
NB_REFRESH_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_CREATE_REFRESH_SESSION ("05 - refresh session"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("05 - session array",
"05 - refresh session init loop",
"05 - refresh session",
NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("05 - end",
"05 - refresh session init loop"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"), PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"),

View File

@ -94,7 +94,21 @@ data_free (struct PERF_TALER_MINTDB_Data *data)
data->data.dki = NULL; data->data.dki = NULL;
break; break;
default: case PERF_TALER_MINTDB_REFRESH_HASH:
if (NULL == data->data.session_hash)
break;
GNUNET_free (data->data.session_hash);
data->data.session_hash = NULL;
break;
case PERF_TALER_MINTDB_REFRESH_MELT:
if (NULL == data->data.refresh_melt)
break;
PERF_TALER_MINTDB_refresh_melt_free (data->data.refresh_melt);
data->data.refresh_melt = NULL;
break;
case PERF_TALER_MINTDB_NONE:
break; break;
} }
} }
@ -138,8 +152,19 @@ data_copy (const struct PERF_TALER_MINTDB_Data *data,
= PERF_TALER_MINTDB_denomination_copy (data->data.dki); = PERF_TALER_MINTDB_denomination_copy (data->data.dki);
return; return;
default: case PERF_TALER_MINTDB_REFRESH_HASH:
return; copy-> data.session_hash = GNUNET_new (struct GNUNET_HashCode);
*copy->data.session_hash
= *data->data.session_hash;
break;
case PERF_TALER_MINTDB_REFRESH_MELT:
copy->data.refresh_melt
= PERF_TALER_MINTDB_refresh_melt_copy (data->data.refresh_melt);
break;
case PERF_TALER_MINTDB_NONE:
break;
} }
} }
@ -719,6 +744,55 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_refresh_session.label_hash);
if (GNUNET_SYSERR != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_refresh_session.label_hash);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_REFRESH_HASH != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_refresh_session.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_refresh_session.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_refresh_melt.label_hash);
if (GNUNET_SYSERR != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_refresh_melt.label_hash);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_REFRESH_HASH != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_refresh_melt.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_refresh_melt.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_END: case PERF_TALER_MINTDB_CMD_END:
case PERF_TALER_MINTDB_CMD_DEBUG: case PERF_TALER_MINTDB_CMD_DEBUG:
@ -733,6 +807,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
default: default:
break; break;
} }
} }
return GNUNET_OK; return GNUNET_OK;
@ -1217,15 +1292,16 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION: case PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION:
{ {
struct GNUNET_HashCode hash; struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshSession *refresh_session; struct TALER_MINTDB_RefreshSession *refresh_session;
hash = GNUNET_new (struct GNUNET_HashCode);
refresh_session = PERF_TALER_MINTDB_refresh_session_init (); refresh_session = PERF_TALER_MINTDB_refresh_session_init ();
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
&hash); hash);
state->plugin->create_refresh_session (state->session, state->plugin->create_refresh_session (state->session,
state->session, state->session,
&hash, hash,
refresh_session); refresh_session);
state->cmd[state->i].exposed.data.session_hash = hash; state->cmd[state->i].exposed.data.session_hash = hash;
PERF_TALER_MINTDB_refresh_session_free (refresh_session); PERF_TALER_MINTDB_refresh_session_free (refresh_session);
@ -1235,16 +1311,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION: case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION:
{ {
int hash_index; unsigned int hash_index;
struct GNUNET_HashCode hash; struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshSession refresh; struct TALER_MINTDB_RefreshSession refresh;
hash_index = cmd_find (state->cmd, hash_index = state->cmd[state->i].details.get_refresh_session.index_hash;
state->cmd[state->i].details.get_refresh_session.label_hash);
hash = state->cmd[hash_index].exposed.data.session_hash; hash = state->cmd[hash_index].exposed.data.session_hash;
state->plugin->get_refresh_session (state->session, state->plugin->get_refresh_session (state->session,
state->session, state->session,
&hash, hash,
&refresh); &refresh);
} }
break; break;
@ -1253,19 +1328,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{ {
int hash_index; int hash_index;
int coin_index; int coin_index;
struct GNUNET_HashCode hash; struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt *melt; struct TALER_MINTDB_RefreshMelt *melt;
struct PERF_TALER_MINTDB_Coin *coin; struct PERF_TALER_MINTDB_Coin *coin;
hash_index = cmd_find (state->cmd, hash_index = state->cmd[state->i].details.insert_refresh_melt.index_hash;
state->cmd[state->i].details.insert_refresh_melt.label_hash); coin_index = state->cmd[state->i].details.insert_refresh_melt.index_coin;
coin_index = cmd_find (state->cmd,
state->cmd[state->i].details.insert_refresh_melt.label_coin);
GNUNET_assert (GNUNET_SYSERR != hash_index);
GNUNET_assert (GNUNET_SYSERR != coin_index);
hash = state->cmd[hash_index].exposed.data.session_hash; hash = state->cmd[hash_index].exposed.data.session_hash;
coin = state->cmd[coin_index].exposed.data.coin; coin = state->cmd[coin_index].exposed.data.coin;
melt = PERF_TALER_MINTDB_refresh_melt_init (&hash, melt = PERF_TALER_MINTDB_refresh_melt_init (hash,
coin); coin);
state->plugin->insert_refresh_melt (state->plugin->cls, state->plugin->insert_refresh_melt (state->plugin->cls,
state->session, state->session,
@ -1278,7 +1349,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT: case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
{ {
int hash_index; int hash_index;
struct GNUNET_HashCode hash; struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt melt; struct TALER_MINTDB_RefreshMelt melt;
hash_index = cmd_find (state->cmd, hash_index = cmd_find (state->cmd,
@ -1286,7 +1357,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
hash = state->cmd[hash_index].exposed.data.session_hash; hash = state->cmd[hash_index].exposed.data.session_hash;
state->plugin->get_refresh_melt (state->plugin->cls, state->plugin->get_refresh_melt (state->plugin->cls,
state->session, state->session,
&hash, hash,
1, 1,
&melt); &melt);
} }
@ -1296,20 +1367,17 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{ {
int hash_index; int hash_index;
int denom_index; int denom_index;
struct GNUNET_HashCode session_hash; struct GNUNET_HashCode *session_hash;
struct TALER_MINTDB_DenominationKeyIssueInformation *denom; struct TALER_MINTDB_DenominationKeyIssueInformation *denom;
hash_index = cmd_find (state->cmd, hash_index = state->cmd[state->i].details.insert_refresh_order.index_hash;
state->cmd[state->i].details.insert_refresh_order.label_hash); denom_index = state->cmd[state->i].details.insert_refresh_order.index_denom;
GNUNET_assert (GNUNET_SYSERR != hash_index);
denom_index = cmd_find (state->cmd,
state->cmd[state->i].details.insert_refresh_order.label_denom);
GNUNET_assert (GNUNET_SYSERR != denom_index); GNUNET_assert (GNUNET_SYSERR != denom_index);
session_hash = state->cmd[hash_index].exposed.data.session_hash; session_hash = state->cmd[hash_index].exposed.data.session_hash;
denom = state->cmd[denom_index].exposed.data.dki; denom = state->cmd[denom_index].exposed.data.dki;
state->plugin->insert_refresh_order (state->plugin->cls, state->plugin->insert_refresh_order (state->plugin->cls,
state->session, state->session,
&session_hash, session_hash,
1, 1,
&denom->denom_pub); &denom->denom_pub);
@ -1319,16 +1387,14 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_REFRESH_ORDER: case PERF_TALER_MINTDB_CMD_GET_REFRESH_ORDER:
{ {
int hash_index; int hash_index;
struct GNUNET_HashCode hash; struct GNUNET_HashCode *hash;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
hash_index = cmd_find (state->cmd, hash_index = state->cmd[state->i].details.get_refresh_order.index_hash;
state->cmd[state->i].details.get_refresh_order.label_hash);
GNUNET_assert (GNUNET_SYSERR != hash_index);
hash = state->cmd[hash_index].exposed.data.session_hash; hash = state->cmd[hash_index].exposed.data.session_hash;
state->plugin->get_refresh_order (state->plugin->cls, state->plugin->get_refresh_order (state->plugin->cls,
state->session, state->session,
&hash, hash,
1, 1,
&denom_pub); &denom_pub);
} }

View File

@ -450,7 +450,65 @@
_label_coin), \ _label_coin), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "insert", \ PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "insert", \
_label "deposit") _label "deposit")
/**
* Insert informations about a refresh session
* melts one coin into another
*
* @param _label the label of the command
*/
#define PERF_TALER_MINTDB_INIT_CMD_CREATE_REFRESH_SESSION(_label) \
{ \
.command = PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_REFRESH_HASH \
}
/**
* Get informations about a refresh session
*
* @param _label the label of the command
* @param _label_hash the label of the hash to search
*/
#define PERF_TALER_MINTDB_INIT_CMD_GET_REFRESH_SESSION(_label, \
_label_hash) \
{ \
.command = PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_REFRESH_MELT \
}
/**
* Insert a melt operation in the database
*
* @param _label the label of the command
* @param _label_hash the label of the hash of the session
* @param _label_coin the label of the coin to melt
*/
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_REFRESH_MELT(_label, \
_label_hash, \
_label_coin), \
{ \
.command = PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT, \
.label = _label, \
.details.insert_refresh_melt.label_hash = _label_hash, \
.details.insert_refresh_melt.label_coin = _label_coin, \
.exposed.type = PERF_TALER_MINTDB_NONE \
}
/**
* Get informations about a melt operation
*
* @param _label the label of the command
* @param _label_hash the label of the hash of the refresh session
*/
#define PERF_TALER_MINTDB_INIT_CMD_GET_REFRESH_MELT(_label, \
_label_hash) \
{ \
.command = PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT, \
.label = _label, \
.detail.get_refresh_melt.label_hash = _label_hash, \
.exposed.type = PERF_TALER_MINTDB_NONE \
}
/** /**
* The type of data stored in #PERF_TALER_MINTDB_Memory * The type of data stored in #PERF_TALER_MINTDB_Memory
@ -463,7 +521,8 @@ enum PERF_TALER_MINTDB_Type
PERF_TALER_MINTDB_RESERVE, PERF_TALER_MINTDB_RESERVE,
PERF_TALER_MINTDB_COIN, PERF_TALER_MINTDB_COIN,
PERF_TALER_MINTDB_DEPOSIT, PERF_TALER_MINTDB_DEPOSIT,
PERF_TALER_MINTDB_REFRESH_HASH PERF_TALER_MINTDB_REFRESH_HASH,
PERF_TALER_MINTDB_REFRESH_MELT
}; };
@ -491,7 +550,9 @@ struct PERF_TALER_MINTDB_Data
/** #PERF_TALER_MINTDB_DENOMINATION_INFO */ /** #PERF_TALER_MINTDB_DENOMINATION_INFO */
struct TALER_MINTDB_DenominationKeyIssueInformation *dki; struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
/** #PERF_TALER_MINTDB_REFRESH_HASH */ /** #PERF_TALER_MINTDB_REFRESH_HASH */
struct GNUNET_HashCode session_hash; struct GNUNET_HashCode *session_hash;
/** #PERF_TALER_MINTDB_REFRESH_MELT */
struct TALER_MINTDB_RefreshMelt *refresh_melt;
} data; } data;
}; };
@ -1037,7 +1098,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the coin to melt * The label of the coin to melt
*/ */
const char *label_coin; const char *label_coin;
const char coin; unsigned int index_coin;
} insert_refresh_melt; } insert_refresh_melt;
/** /**

View File

@ -125,9 +125,11 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
"03 - init withdraw loop", "03 - init withdraw loop",
"02 - save reserve"), "02 - save reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw", PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW ("03 - withdraw",
"03 - denomination load", "03 - denomination load",
"03 - reserve load"), "03 - reserve load"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - insert withdraw",
"03 - withdraw"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("03 - commit transaction"), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("03 - commit transaction"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - coin array", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - coin array",
"03 - init withdraw loop", "03 - init withdraw loop",
@ -145,8 +147,10 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - coin load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - coin load",
"04 - deposit init loop", "04 - deposit init loop",
"03 - coin array"), "03 - coin array"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit", PERF_TALER_MINTDB_INIT_CMD_CREATE_DEPOSIT ("04 - deposit",
"04 - coin load"), "04 - coin load"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - insert deposit",
"04 - deposit"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("04 - commit transaction"), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("04 - 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",