aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-10 18:12:27 +0200
committerFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-10 18:12:27 +0200
commit8791ce6a04e0313005c6e84469bd3fc63e0bb460 (patch)
tree66761c776825dbd50e871d803ddb593ff2f520b3 /src
parentd6c1340bcdfef8228a7802bf046f4f8babf44f5e (diff)
added new benchmarks
Diffstat (limited to 'src')
-rw-r--r--src/mintdb/perf_taler_mintdb.c22
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c132
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.h67
-rw-r--r--src/mintdb/test_perf_taler_mintdb.c8
4 files changed, 188 insertions, 41 deletions
diff --git a/src/mintdb/perf_taler_mintdb.c b/src/mintdb/perf_taler_mintdb.c
index 11ae6f526..80cb3069e 100644
--- a/src/mintdb/perf_taler_mintdb.c
+++ b/src/mintdb/perf_taler_mintdb.c
@@ -25,8 +25,8 @@
#define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15
-#define BIGGER 10
-#define BIG 10
+#define BIGGER 100000
+#define BIG 10000
#define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG
@@ -37,6 +37,9 @@
#define NB_WITHDRAW_INIT BIGGER
#define NB_WITHDRAW_SAVE BIG
+#define NB_REFRESH_INIT BIGGER
+#define NB_REFRESH_SAVE BIG
+
/**
* Runs the performances tests for the mint database
* and logs the results using Gauger
@@ -118,8 +121,21 @@ main (int argc, char ** argv)
NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"04 - deposit init loop"),
- PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of 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_GET_TIME ("05 - start"),
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index eee4e712e..8db141f67 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -94,7 +94,21 @@ data_free (struct PERF_TALER_MINTDB_Data *data)
data->data.dki = NULL;
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;
}
}
@@ -138,8 +152,19 @@ data_copy (const struct PERF_TALER_MINTDB_Data *data,
= PERF_TALER_MINTDB_denomination_copy (data->data.dki);
return;
- default:
- return;
+ case PERF_TALER_MINTDB_REFRESH_HASH:
+ 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;
+ 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_DEBUG:
@@ -733,6 +807,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
default:
break;
+
}
}
return GNUNET_OK;
@@ -1217,15 +1292,16 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION:
{
- struct GNUNET_HashCode hash;
+ struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshSession *refresh_session;
+ hash = GNUNET_new (struct GNUNET_HashCode);
refresh_session = PERF_TALER_MINTDB_refresh_session_init ();
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
- &hash);
+ hash);
state->plugin->create_refresh_session (state->session,
state->session,
- &hash,
+ hash,
refresh_session);
state->cmd[state->i].exposed.data.session_hash = hash;
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:
{
- int hash_index;
- struct GNUNET_HashCode hash;
+ unsigned int hash_index;
+ struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshSession refresh;
- hash_index = cmd_find (state->cmd,
- state->cmd[state->i].details.get_refresh_session.label_hash);
+ hash_index = state->cmd[state->i].details.get_refresh_session.index_hash;
hash = state->cmd[hash_index].exposed.data.session_hash;
state->plugin->get_refresh_session (state->session,
state->session,
- &hash,
+ hash,
&refresh);
}
break;
@@ -1253,19 +1328,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{
int hash_index;
int coin_index;
- struct GNUNET_HashCode hash;
+ struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt *melt;
struct PERF_TALER_MINTDB_Coin *coin;
- hash_index = cmd_find (state->cmd,
- state->cmd[state->i].details.insert_refresh_melt.label_hash);
- 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_index = state->cmd[state->i].details.insert_refresh_melt.index_hash;
+ coin_index = state->cmd[state->i].details.insert_refresh_melt.index_coin;
hash = state->cmd[hash_index].exposed.data.session_hash;
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);
state->plugin->insert_refresh_melt (state->plugin->cls,
state->session,
@@ -1278,7 +1349,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
{
int hash_index;
- struct GNUNET_HashCode hash;
+ struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt melt;
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;
state->plugin->get_refresh_melt (state->plugin->cls,
state->session,
- &hash,
+ hash,
1,
&melt);
}
@@ -1296,20 +1367,17 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{
int hash_index;
int denom_index;
- struct GNUNET_HashCode session_hash;
+ struct GNUNET_HashCode *session_hash;
struct TALER_MINTDB_DenominationKeyIssueInformation *denom;
- hash_index = cmd_find (state->cmd,
- state->cmd[state->i].details.insert_refresh_order.label_hash);
- GNUNET_assert (GNUNET_SYSERR != hash_index);
- denom_index = cmd_find (state->cmd,
- state->cmd[state->i].details.insert_refresh_order.label_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,
state->session,
- &session_hash,
+ session_hash,
1,
&denom->denom_pub);
@@ -1319,16 +1387,14 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_REFRESH_ORDER:
{
int hash_index;
- struct GNUNET_HashCode hash;
+ struct GNUNET_HashCode *hash;
struct TALER_DenominationPublicKey denom_pub;
- hash_index = cmd_find (state->cmd,
- state->cmd[state->i].details.get_refresh_order.label_hash);
- GNUNET_assert (GNUNET_SYSERR != hash_index);
+ hash_index = state->cmd[state->i].details.get_refresh_order.index_hash;
hash = state->cmd[hash_index].exposed.data.session_hash;
state->plugin->get_refresh_order (state->plugin->cls,
state->session,
- &hash,
+ hash,
1,
&denom_pub);
}
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.h b/src/mintdb/perf_taler_mintdb_interpreter.h
index 3a410fd52..5f982cbd9 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.h
+++ b/src/mintdb/perf_taler_mintdb_interpreter.h
@@ -450,7 +450,65 @@
_label_coin), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "insert", \
_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
@@ -463,7 +521,8 @@ enum PERF_TALER_MINTDB_Type
PERF_TALER_MINTDB_RESERVE,
PERF_TALER_MINTDB_COIN,
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 */
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
/** #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;
};
@@ -1037,7 +1098,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the coin to melt
*/
const char *label_coin;
- const char coin;
+ unsigned int index_coin;
} insert_refresh_melt;
/**
diff --git a/src/mintdb/test_perf_taler_mintdb.c b/src/mintdb/test_perf_taler_mintdb.c
index 396c03cc3..4397bc71b 100644
--- a/src/mintdb/test_perf_taler_mintdb.c
+++ b/src/mintdb/test_perf_taler_mintdb.c
@@ -125,9 +125,11 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
"03 - init withdraw loop",
"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 - 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_SAVE_ARRAY ("03 - coin array",
"03 - init withdraw loop",
@@ -145,8 +147,10 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - coin load",
"04 - deposit init loop",
"03 - coin array"),
- PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit",
+ PERF_TALER_MINTDB_INIT_CMD_CREATE_DEPOSIT ("04 - deposit",
"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_SAVE_ARRAY ("04 - deposit array",
"04 - deposit init loop",