preliminary work on more benchmarks

This commit is contained in:
Fournier Nicolas 2015-08-17 10:56:56 +02:00
parent 8e6f121a68
commit 0a1491562c
5 changed files with 392 additions and 41 deletions

View File

@ -143,6 +143,8 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOOP ("06 - refresh melt init loop",
NB_MELT_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
/* TODO: initialize using coins & sessions created localy
* in order to make sure the same coin are not melted twice*/
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - session hash",
"06 - refresh melt init loop",
"05 - session array"),

View File

@ -565,24 +565,54 @@ struct TALER_MINTDB_RefreshCommitCoin *
PERF_TALER_MINTDB_refresh_commit_coin_init ()
{
struct TALER_MINTDB_RefreshCommitCoin *commit_coin;
struct TALER_RefreshLinkEncrypted *refresh_link;
struct TALER_RefreshLinkEncrypted refresh_link;
commit_coin = GNUNET_new (struct TALER_MINTDB_RefreshCommitCoin);
GNUNET_assert (NULL != commit_coin);
{/* refresh_link */
refresh_link = GNUNET_new (struct TALER_RefreshLinkEncrypted);
*refresh_link = (struct TALER_RefreshLinkEncrypted)
refresh_link = (struct TALER_RefreshLinkEncrypted)
{
.blinding_key_enc = "blinding_key",
.blinding_key_enc_size = 13
};
refresh_link->blinding_key_enc_size = 32;
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&refresh_link->coin_priv_enc,
&refresh_link.coin_priv_enc,
sizeof(struct TALER_CoinSpendPrivateKeyP));
}
commit_coin->coin_ev = "coin_ev";
commit_coin->coin_ev_size = 8;
commit_coin->refresh_link = refresh_link;
commit_coin->refresh_link = GNUNET_new (struct TALER_RefreshLinkEncrypted);
*commit_coin->refresh_link = refresh_link;
return commit_coin;
}
/**
* Copies a #TALER_MINTDB_RefreshCommitCoin
*
* @param commit_coin the commit to copy
* @return a copy of @a commit_coin
*/
struct TALER_MINTDB_RefreshCommitCoin *
PERF_TALER_MINTDB_refresh_commit_coin_copy (struct TALER_MINTDB_RefreshCommitCoin *commit_coin)
{
struct TALER_MINTDB_RefreshCommitCoin *copy;
copy = GNUNET_new (struct TALER_MINTDB_RefreshCommitCoin);
copy->refresh_link = GNUNET_new (struct TALER_RefreshLinkEncrypted);
*copy->refresh_link = *commit_coin->refresh_link;
return copy;
}
/**
* Free a #TALER_MINTDB_RefreshCommitCoin
*
* @param commit_coin the coin to free
*/
void
PERF_TALER_MINTDB_refresh_commit_coin_free (struct TALER_MINTDB_RefreshCommitCoin *commit_coin)
{
GNUNET_free (commit_coin->refresh_link);
GNUNET_free (commit_coin);
}

View File

@ -174,6 +174,29 @@ PERF_TALER_MINTDB_coin_free (
struct PERF_TALER_MINTDB_Coin *coin);
/**
* @return a randomly generated refresh session
*/
struct TALER_MINTDB_RefreshSession *
PERF_TALER_MINTDB_refresh_session_init (void);
/**
* @return #GNUNET_OK if the copy was successful, #GNUNET_SYSERR if it wasn't
*/
int
PERF_TALER_MINTDB_refresh_session_copy (struct TALER_MINTDB_RefreshSession *session,
struct TALER_MINTDB_RefreshSession *copy);
/**
* Frees memory of a refresh_session
*/
int
PERF_TALER_MINTDB_refresh_session_free (
struct TALER_MINTDB_RefreshSession *refresh_session);
/**
* Create a melt operation
*
@ -207,25 +230,28 @@ PERF_TALER_MINTDB_refresh_melt_free (struct TALER_MINTDB_RefreshMelt *melt);
/**
* @return a randomly generated refresh session
* Create a #TALER_MINTDB_RefreshCommitCoin
*/
struct TALER_MINTDB_RefreshSession *
PERF_TALER_MINTDB_refresh_session_init (void);
struct TALER_MINTDB_RefreshCommitCoin *
PERF_TALER_MINTDB_refresh_commit_coin_init (void);
/**
* @return #GNUNET_OK if the copy was successful, #GNUNET_SYSERR if it wasn't
* Copies a #TALER_MINTDB_RefreshCommitCoin
*
* @param commit_coin the commit to copy
* @return a copy of @a commit_coin
*/
int
PERF_TALER_MINTDB_refresh_session_copy (struct TALER_MINTDB_RefreshSession *session,
struct TALER_MINTDB_RefreshSession *copy);
struct TALER_MINTDB_RefreshCommitCoin *
PERF_TALER_MINTDB_refresh_commit_coin_copy (struct TALER_MINTDB_RefreshCommitCoin *commit_coin);
/**
* Frees memory of a refresh_session
* Free a #TALER_MINTDB_RefreshCommitCoin
*
* @param commit_coin the coin to free
*/
int
PERF_TALER_MINTDB_refresh_session_free (
struct TALER_MINTDB_RefreshSession *refresh_session);
void
PERF_TALER_MINTDB_refresh_commit_coin_free (struct TALER_MINTDB_RefreshCommitCoin *commit_coin);
#endif

View File

@ -839,20 +839,288 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_ORDER:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.insert_refresh_order.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_refresh_order.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.insert_refresh_order.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.insert_refresh_order.index_hash = ret;
ret = cmd_find (cmd,
cmd[i].details.insert_refresh_order.label_denom);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_refresh_order.label_denom);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_refresh_order.label_denom);
return GNUNET_SYSERR;
}
cmd[i].details.insert_refresh_order.index_denom = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_ORDER:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_refresh_order.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_refresh_order.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_order.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_refresh_order.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_COIN:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.insert_refresh_commit_coin.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_refresh_commit_coin.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.insert_refresh_commit_coin.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.insert_refresh_commit_coin.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_COIN:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_refresh_commit_coin.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_refresh_commit_coin.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_commit_coin.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_refresh_commit_coin.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_LINK:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.insert_refresh_commit_link.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_refresh_commit_link.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.insert_refresh_commit_link.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.insert_refresh_commit_link.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_LINK:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_refresh_commit_link.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_refresh_commit_link.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_commit_link.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_refresh_commit_link.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_MELT_COMMITMENT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_melt_commitment.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_melt_commitment.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_melt_commitment.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_melt_commitment.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_OUT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.insert_refresh_out.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_refresh_out.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.insert_refresh_out.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.insert_refresh_out.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_LINK_DATA_LIST:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_link_data_list.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_link_data_list.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_link_data_list.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_link_data_list.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_TRANSFER:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_transfer.label_hash);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_transfer.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_transfer.label_hash);
return GNUNET_SYSERR;
}
cmd[i].details.get_transfer.index_hash = ret;
}
break;
case PERF_TALER_MINTDB_CMD_END:
case PERF_TALER_MINTDB_CMD_DEBUG:
case PERF_TALER_MINTDB_CMD_LOOP:
case PERF_TALER_MINTDB_CMD_NEW_SESSION:
case PERF_TALER_MINTDB_CMD_START_TRANSACTION:
case PERF_TALER_MINTDB_CMD_COMMIT_TRANSACTION:
case PERF_TALER_MINTDB_CMD_ABORT_TRANSACTION:
case PERF_TALER_MINTDB_CMD_GET_TIME:
case PERF_TALER_MINTDB_CMD_CREATE_DENOMINATION:
case PERF_TALER_MINTDB_CMD_CREATE_RESERVE:
case PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION:
break;
default:
break;
}
}
return GNUNET_OK;
@ -1003,7 +1271,8 @@ interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state)
save_index = cmd->details.load_array.index_save;
loop_iter = state->cmd[loop_index].details.loop.curr_iteration;
{
int i, quotient;
unsigned int i;
unsigned int quotient;
/* In case the iteration number is higher than the amount saved,
* the number is run several times in the permutation array */
@ -1078,9 +1347,11 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GAUGER:
{
int start_index, stop_index;
unsigned int start_index;
unsigned int stop_index;
float ips;
struct GNUNET_TIME_Absolute start, stop;
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Absolute stop;
struct GNUNET_TIME_Relative elapsed;
start_index = state->cmd[state->i].details.gauger.index_start;
@ -1416,14 +1687,13 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_ORDER:
{
int hash_index;
int denom_index;
unsigned int hash_index;
unsigned int denom_index;
struct GNUNET_HashCode *session_hash;
struct TALER_MINTDB_DenominationKeyIssueInformation *denom;
hash_index = state->cmd[state->i].details.insert_refresh_order.index_hash;
denom_index = state->cmd[state->i].details.insert_refresh_order.index_denom;
GNUNET_assert (GNUNET_SYSERR != denom_index);
session_hash = state->cmd[hash_index].exposed.data.session_hash;
denom = state->cmd[denom_index].exposed.data.dki;
state->plugin->insert_refresh_order (state->plugin->cls,
@ -1453,21 +1723,35 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_COIN:
{
int hash_index;
int ret;
unsigned int hash_index;
struct TALER_MINTDB_RefreshCommitCoin *refresh_commit;
hash_index = state->cmd[state->i].details.insert_refresh_commit_coin.index_hash;
refresh_commit = PERF_TALER_MINTDB_refresh_commit_coin_init ();
ret = state->plugin->insert_refresh_commit_coins (state->plugin->cls,
state->session,
state->cmd[hash_index].exposed.data.session_hash,
1,
1,
refresh_commit);
hash_index = cmd_find (state->cmd,
state->cmd[state->i].details.insert_refresh_commit_coin.label_hash);
GNUNET_assert (GNUNET_SYSERR != hash_index);
}
break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_COIN:
{
int hash_index;
unsigned int hash_index;
struct TALER_MINTDB_RefreshCommitCoin refresh_commit;
hash_index = state->cmd[state->i].details.insert_refresh_commit_coin.index_hash;
state->plugin->get_refresh_commit_coins (state->plugin->cls,
state->session,
state->cmd[hash_index].exposed.data.session_hash,
1,
1,
&refresh_commit);
hash_index = cmd_find (state->cmd,
state->cmd[state->i].details.insert_refresh_commit_coin.label_hash);
GNUNET_assert (GNUNET_SYSERR != hash_index);
}
break;
@ -1475,9 +1759,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{
int hash_index;
hash_index = cmd_find (state->cmd,
state->cmd[state->i].details.insert_refresh_commit_link.label_hash);
GNUNET_assert (GNUNET_SYSERR != hash_index);
hash_index = state->cmd[state->i].details.insert_refresh_commit_link.index_hash;
}
break;
@ -1496,8 +1778,6 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_TRANSFER:
break;
default:
break;
}
}
return GNUNET_OK;

View File

@ -1157,6 +1157,19 @@ union PERF_TALER_MINTDB_CMD_Details
} insert_refresh_commit_coin;
/**
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_COIN command
*/
struct PERF_TALER_MINTDB_CMD_getRefreshCommitCoinDetails
{
/**
* The refresh session hash
*/
const char *label_hash;
unsigned int index_hash;
} get_refresh_commit_coin;
/**
* Data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_LINK command
*/
@ -1216,7 +1229,7 @@ union PERF_TALER_MINTDB_CMD_Details
*/
const char *label_hash;
unsigned int index_hash;
} get_link_datat_list;
} get_link_data_list;
/**
* Data requiered by the #PERF_TALER_MINTDB_CMD_GET_TRANSFER command