aboutsummaryrefslogtreecommitdiff
path: root/src/mintdb
diff options
context:
space:
mode:
Diffstat (limited to 'src/mintdb')
-rw-r--r--src/mintdb/perf_taler_mintdb.c134
-rw-r--r--src/mintdb/perf_taler_mintdb_init.c26
-rw-r--r--src/mintdb/perf_taler_mintdb_init.h2
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c95
4 files changed, 210 insertions, 47 deletions
diff --git a/src/mintdb/perf_taler_mintdb.c b/src/mintdb/perf_taler_mintdb.c
index 8d4164504..4a4e84d11 100644
--- a/src/mintdb/perf_taler_mintdb.c
+++ b/src/mintdb/perf_taler_mintdb.c
@@ -22,17 +22,17 @@
#include "perf_taler_mintdb_interpreter.h"
-#define NB_DENOMINATION_INIT 10
-#define NB_DENOMINATION_SAVE 10
+#define NB_DENOMINATION_INIT 15
+#define NB_DENOMINATION_SAVE 15
-#define NB_RESERVE_INIT 1000
-#define NB_RESERVE_SAVE 100
+#define NB_RESERVE_INIT 100000
+#define NB_RESERVE_SAVE 10000
-#define NB_DEPOSIT_INIT 1000
-#define NB_DEPOSIT_SAVE 100
+#define NB_DEPOSIT_INIT 100000
+#define NB_DEPOSIT_SAVE 10000
-#define NB_WITHDRAW_INIT 1000
-#define NB_WITHDRAW_SAVE 100
+#define NB_WITHDRAW_INIT 100000
+#define NB_WITHDRAW_SAVE 10000
/**
* Runs the performances tests for the mint database
@@ -110,33 +110,115 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
// End of deposit initialization
+ PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"),
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 load",
- "05 - loop",
- "04 - deposit array"),
- PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT ("",
- "05 - deposit load"),
- PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - reserve insert measure",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE (""),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "05 - loop"),
+ "05 - reserve insert measure"),
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),
+ "Number of reserve inserted per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve insertion"),
+
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("06 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("06 - reserve load measure",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - reserve",
+ "06 - reserve load measure",
+ "02 - save reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE ("",
+ "06 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
+ "06 - reserve load measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("06 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
+ "06 - start",
+ "06 - stop",
+ "Number of reserve loaded per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve retreival"),
+
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("07 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("07 - reserve history measure",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("07 - reserve",
+ "07 - reserve history measure",
+ "02 - save reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY ("",
+ "07 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
+ "07 - reserve history measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("07 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
+ "07 - start",
+ "07 - stop",
+ "Number of reserve history loaded per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve history access"),
+
+
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("08 - withdraw insert measure",
+ NB_WITHDRAW_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - reserve",
+ "08 - withdraw insert measure",
+ "02 - save reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - denomination",
+ "08 - withdraw insert measure",
+ "01 - save denomination"),
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("",
+ "08 - denomination",
+ "08 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
+ "08 - withdraw insert measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
+ "08 - start",
+ "08 - stop",
+ "Number of withdraw insert per second",
+ "item/sec",
+ NB_WITHDRAW_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of withdraw insertion"),
+
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("09 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("09 - withdraw insert measure",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("09 - reserve",
+ "09 - withdraw insert measure",
+ "03 - save coin"),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("09 - denomination",
+ "09 - withdraw insert measure",
+ "01 - save denomination"),
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("",
+ "09 - denomination",
+ "09 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
+ "09 - withdraw insert measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("09 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
+ "09 - start",
+ "09 - stop",
+ "Number of reserve loaded per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of withdraw loading"),
+
PERF_TALER_MINTDB_INIT_CMD_END (""),
};
- ret = PERF_TALER_MINTDB_run_benchmark ("perf-taler-mintdb",
- "./test-mint-db-postgres.conf",
- (struct PERF_TALER_MINTDB_Cmd [])
- {PERF_TALER_MINTDB_INIT_CMD_END("")},
- benchmark);
+ ret = PERF_TALER_MINTDB_run_benchmark (
+ "perf-taler-mintdb",
+ "./test-mint-db-postgres.conf",
+ (struct PERF_TALER_MINTDB_Cmd []) {PERF_TALER_MINTDB_INIT_CMD_END("")},
+ benchmark);
if (GNUNET_SYSERR == ret)
return 1;
return 0;
diff --git a/src/mintdb/perf_taler_mintdb_init.c b/src/mintdb/perf_taler_mintdb_init.c
index 2fe978f64..5c18c664e 100644
--- a/src/mintdb/perf_taler_mintdb_init.c
+++ b/src/mintdb/perf_taler_mintdb_init.c
@@ -534,24 +534,13 @@ PERF_TALER_MINTDB_coin_public_info_free (struct TALER_CoinPublicInfo *cpi)
*/
struct TALER_MINTDB_RefreshMelt *
PERF_TALER_MINTDB_refresh_melt_init (struct GNUNET_HashCode *session,
- struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
+ struct PERF_TALER_MINTDB_Coin *coin)
{
struct TALER_MINTDB_RefreshMelt *melt;
- struct GNUNET_CRYPTO_EddsaPrivateKey *coin_key;
- struct TALER_CoinPublicInfo cpi;
- struct TALER_CoinSpendSignatureP coin_spent;
+ struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_Amount amount;
struct TALER_Amount amount_with_fee;
- coin_key = GNUNET_CRYPTO_eddsa_key_create ();
- cpi.denom_pub = dki->denom_pub;
- GNUNET_CRYPTO_eddsa_key_get_public (coin_key,
- &cpi.coin_pub.eddsa_pub);
- GNUNET_assert (NULL !=
- (cpi.denom_sig.rsa_signature =
- GNUNET_CRYPTO_rsa_sign (dki->denom_priv.rsa_private_key,
- &cpi.coin_pub.eddsa_pub,
- sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))));
{
struct
{
@@ -562,22 +551,21 @@ PERF_TALER_MINTDB_refresh_melt_init (struct GNUNET_HashCode *session,
to_sign.purpose.purpose = GNUNET_SIGNATURE_PURPOSE_TEST;
to_sign.purpose.size = htonl (sizeof (to_sign));
to_sign.session = *session;
- GNUNET_CRYPTO_eddsa_sign (coin_key,
+ GNUNET_CRYPTO_eddsa_sign (&coin->priv,
&to_sign.purpose,
- &coin_spent.eddsa_signature);
+ &coin_sig.eddsa_signature);
}
- GNUNET_assert (GNUNET_OK == TALER_string_to_amount (CURRENCY ":10.0",
+ GNUNET_assert (GNUNET_OK == TALER_string_to_amount (CURRENCY ":1.1",
&amount));
GNUNET_assert (GNUNET_OK == TALER_string_to_amount (CURRENCY ":0.1",
&amount_with_fee));
melt = GNUNET_new (struct TALER_MINTDB_RefreshMelt);
- melt->coin = cpi;
- melt->coin_sig = coin_spent;
+ melt->coin = coin->public_info;
+ melt->coin_sig = coin_sig;
melt->session_hash = *session;
melt->amount_with_fee = amount;
melt->melt_fee = amount_with_fee;
- GNUNET_free (coin_key);
return melt;
}
diff --git a/src/mintdb/perf_taler_mintdb_init.h b/src/mintdb/perf_taler_mintdb_init.h
index 7a96f66d8..c159770fc 100644
--- a/src/mintdb/perf_taler_mintdb_init.h
+++ b/src/mintdb/perf_taler_mintdb_init.h
@@ -183,7 +183,7 @@ PERF_TALER_MINTDB_coin_free (
*/
struct TALER_MINTDB_RefreshMelt *
PERF_TALER_MINTDB_refresh_melt_init (struct GNUNET_HashCode *session,
- struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
+ struct PERF_TALER_MINTDB_Coin *coin);
/**
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index e9ee05e33..45a3002a5 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -678,7 +678,100 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
}
break;
- default :
+ case PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION:
+ {
+ int coin_index;
+ struct PERF_TALER_MINTDB_Coin *coin;
+ struct TALER_MINTDB_TransactionList *transactions;
+
+ coin_index = cmd_find (state->cmd,
+ state->cmd[state->i].details.get_coin_transaction.label_coin);
+ GNUNET_assert (GNUNET_SYSERR != coin_index);
+ coin = state->cmd[coin_index].exposed.data.coin;
+ transactions = state->plugin->get_coin_transactions (state->plugin->cls,
+ state->session,
+ &coin->public_info.coin_pub);
+ state->plugin->free_coin_transaction_list (state->plugin->cls,
+ transactions);
+ }
+ break;
+
+ case PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION:
+ {
+ struct GNUNET_HashCode hash;
+ struct TALER_MINTDB_RefreshSession *refresh_session;
+
+ refresh_session = PERF_TALER_MINTDB_refresh_session_init ();
+ GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
+ &hash);
+ state->plugin->create_refresh_session (state->session,
+ state->session,
+ &hash,
+ refresh_session);
+ state->cmd[state->i].exposed.data.session_hash = hash;
+ PERF_TALER_MINTDB_refresh_session_free (refresh_session);
+ GNUNET_free (refresh_session);
+ }
+ break;
+
+ case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION:
+ {
+ 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 = state->cmd[hash_index].exposed.data.session_hash;
+ state->plugin->get_refresh_session (state->session,
+ state->session,
+ &hash,
+ &refresh);
+ }
+ break;
+
+ case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT:
+ {
+ int hash_index;
+ int coin_index;
+ 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);
+ 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,
+ coin);
+ state->plugin->insert_refresh_melt (state->plugin->cls,
+ state->session,
+ 1,
+ melt);
+ state->cmd[state->i].exposed.data.session_hash = hash;
+ }
+ break;
+
+ case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
+ {
+ int hash_index;
+ struct GNUNET_HashCode hash;
+ struct TALER_MINTDB_RefreshMelt melt;
+
+ hash_index = cmd_find (state->cmd,
+ state->cmd[state->i].details.get_refresh_melt.label_hash);
+ hash = state->cmd[hash_index].exposed.data.session_hash;
+ state->plugin->get_refresh_melt (state->plugin->cls,
+ state->session,
+ &hash,
+ 1,
+ &melt);
+ }
+ break;
+
+ default:
break;
}
}