summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-03 10:26:52 +0200
committerFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-03 10:26:52 +0200
commitf0a1941f3957a53100035285b6c36d10e20c2174 (patch)
tree5bcc3ea3f03a543153874324ede68dac625dadea
parent8cd6fc9b98d21e87300727e54efc5e958616244a (diff)
downloadexchange-f0a1941f3957a53100035285b6c36d10e20c2174.tar.gz
exchange-f0a1941f3957a53100035285b6c36d10e20c2174.tar.bz2
exchange-f0a1941f3957a53100035285b6c36d10e20c2174.zip
Testing for the /deposit api call
-rw-r--r--src/mintdb/perf_taler_mintdb.c31
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c83
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.h14
3 files changed, 79 insertions, 49 deletions
diff --git a/src/mintdb/perf_taler_mintdb.c b/src/mintdb/perf_taler_mintdb.c
index cd6d2524..2ef9bda3 100644
--- a/src/mintdb/perf_taler_mintdb.c
+++ b/src/mintdb/perf_taler_mintdb.c
@@ -25,14 +25,14 @@
#define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15
-#define NB_RESERVE_INIT 10000
-#define NB_RESERVE_SAVE 1000
+#define NB_RESERVE_INIT 100
+#define NB_RESERVE_SAVE 10
-#define NB_DEPOSIT_INIT 10000
-#define NB_DEPOSIT_SAVE 1000
+#define NB_DEPOSIT_INIT 100
+#define NB_DEPOSIT_SAVE 10
-#define NB_WITHDRAW_INIT 10000
-#define NB_WITHDRAW_SAVE 1000
+#define NB_WITHDRAW_INIT 100
+#define NB_WITHDRAW_SAVE 10
/**
* Runs the performances tests for the mint database
@@ -255,6 +255,25 @@ 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),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("12 - coin",
+ "12 - /deposit",
+ "03 - save coin"),
+ PERF_TALER_MINTDB_INIT_CMD_DEPOSIT ("12 - deposit",
+ "12 - coin"),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
+ "12 - /deposit"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
+ "12 - start",
+ "12 - stop",
+ "POSTGRES",
+ "Number of /deposit per second",
+ "item/sec",
+ NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END (""),
};
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index bc36ad8a..078fff4f 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -191,16 +191,15 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.end_loop.label_loop);
return GNUNET_SYSERR;
}
-
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.end_loop.label_loop);
return GNUNET_SYSERR;
@@ -218,7 +217,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.save_array.label_save);
return GNUNET_SYSERR;
@@ -226,7 +225,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_NONE == cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.save_array.label_save);
return GNUNET_SYSERR;
@@ -238,7 +237,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.save_array.label_loop);
return GNUNET_SYSERR;
@@ -246,7 +245,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.save_array.label_loop);
return GNUNET_SYSERR;
@@ -271,7 +270,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.load_array.label_save);
return GNUNET_SYSERR;
@@ -279,7 +278,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.load_array.label_save);
return GNUNET_SYSERR;
@@ -291,7 +290,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.load_array.label_loop);
return GNUNET_SYSERR;
@@ -299,7 +298,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.load_array.label_loop);
return GNUNET_SYSERR;
@@ -325,16 +324,15 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.load_random.label_save);
return GNUNET_SYSERR;
}
-
if (PERF_TALER_MINTDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.load_random.label_save);
return GNUNET_SYSERR;
@@ -352,7 +350,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.gauger.label_start);
return GNUNET_SYSERR;
@@ -360,7 +358,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_TIME != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.gauger.label_start);
return GNUNET_SYSERR;
@@ -372,7 +370,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.gauger.label_stop);
return GNUNET_SYSERR;
@@ -380,7 +378,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_TIME != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.gauger.label_stop);
return GNUNET_SYSERR;
@@ -398,7 +396,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
@@ -406,7 +404,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
@@ -424,7 +422,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
@@ -432,7 +430,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_DEPOSIT != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
@@ -450,7 +448,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.get_reserve.label_reserve);
return GNUNET_SYSERR;
@@ -458,7 +456,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_reserve.label_reserve);
return GNUNET_SYSERR;
@@ -476,7 +474,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.get_reserve_history.label_reserve);
return GNUNET_SYSERR;
@@ -484,7 +482,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_reserve_history.label_reserve);
return GNUNET_SYSERR;
@@ -502,7 +500,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
@@ -510,7 +508,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
@@ -528,7 +526,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_dki);
return GNUNET_SYSERR;
@@ -536,7 +534,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_dki);
return GNUNET_SYSERR;
@@ -548,7 +546,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
@@ -556,7 +554,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
@@ -574,7 +572,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s",
+ "%d:Undefined reference to %s\n",
i,
cmd[i].details.get_withdraw.label_coin);
return GNUNET_SYSERR;
@@ -582,7 +580,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s",
+ "%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_withdraw.label_coin);
return GNUNET_SYSERR;
@@ -1236,14 +1234,20 @@ int
PERF_TALER_MINTDB_interpret (struct TALER_MINTDB_Plugin *db_plugin,
struct PERF_TALER_MINTDB_Cmd cmd[])
{
+ int ret;
struct PERF_TALER_MINTDB_interpreter_state state =
{.i = 0, .cmd = cmd, .plugin = db_plugin};
- cmd_init (state.cmd);
- GNUNET_assert (NULL !=
- (state.session = db_plugin->get_session (db_plugin->cls,
- GNUNET_YES)));
- interpret (&state);
+
+ ret = cmd_init (state.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;
}
@@ -1412,6 +1416,5 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
}
TALER_MINTDB_plugin_unload (plugin);
GNUNET_CONFIGURATION_destroy (config);
-
return ret;
}
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.h b/src/mintdb/perf_taler_mintdb_interpreter.h
index 2ece735d..63e36f7d 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.h
+++ b/src/mintdb/perf_taler_mintdb_interpreter.h
@@ -337,6 +337,14 @@
/**
+ * the /deposit API call
+ */
+#define PERF_TALER_MONTDB_INIT_CMD_DEPOSIT(_label, _label_coin)\
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label ":insert deposit", _label_coin), \
+ PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT (_label ":get deposit", _label ":insert deposit")
+
+
+/**
* Inserts informations about a withdrawal in the database
*
* @exposes #PERF_TALER_MINTDB_COIN
@@ -395,11 +403,11 @@
* @param _label the label of the command
* @param _label_coin the coin used for the deposit
*/
-#define PERF_TALER_MINTDB_INIT_CMD_deposit(_label, _label_coin) \
+#define PERF_TALER_MINTDB_INIT_CMD_DEPOSIT(_label, _label_coin) \
PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \
_label_coin), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "deposit", \
- _label_coin),
+ _label_coin)
/**
@@ -854,7 +862,7 @@ union PERF_TALER_MINTDB_CMD_Details
/**
- * Extra data related to the #PERF_TALER_MINTDB_CMD_GET_WITHDRAW command
+ * Extra data related to the #PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW command
*/
struct PERF_TALER_MINTDB_CMD_insertWithdrawDetails
{