2015-06-09 17:35:33 +02:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
|
|
|
Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
|
|
|
|
|
|
|
|
TALER is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3, or (at your option) any later version.
|
|
|
|
|
|
|
|
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file mintdb/perf_taler_mintdb.c
|
|
|
|
* @brief Mint database performance analysis
|
|
|
|
* @author Nicolas Fournier
|
|
|
|
*/
|
2015-06-12 11:14:32 +02:00
|
|
|
#include "platform.h"
|
2015-06-09 13:03:37 +02:00
|
|
|
#include "perf_taler_mintdb_interpreter.h"
|
2015-06-10 14:59:14 +02:00
|
|
|
#include "perf_taler_mintdb_values.h"
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Runs the performances tests for the mint database
|
2015-06-11 15:55:46 +02:00
|
|
|
* and logs the results using Gauger
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-09 13:03:37 +02:00
|
|
|
int
|
2015-06-11 15:55:46 +02:00
|
|
|
main (int argc, char ** argv)
|
2015-06-09 13:03:37 +02:00
|
|
|
{
|
2015-06-12 11:14:32 +02:00
|
|
|
struct TALER_MINTDB_Plugin *plugin;
|
|
|
|
struct GNUNET_CONFIGURATION_Handle *config;
|
2015-06-25 15:31:15 +02:00
|
|
|
struct PERF_TALER_MINTDB_Cmd test[] =
|
2015-06-11 15:55:46 +02:00
|
|
|
{
|
2015-06-26 15:32:20 +02:00
|
|
|
// Denomination used to create coins
|
2015-07-01 14:11:54 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("00 - Start of interpreter"),
|
2015-06-30 14:01:06 +02:00
|
|
|
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
|
|
|
|
PERF_TALER_MINTDB_NB_DENOMINATION_INIT),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("01 - start transaction"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("01 - commit transaction"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
|
|
|
|
"01 - denomination loop",
|
|
|
|
"01 - denomination",
|
2015-06-30 18:18:31 +02:00
|
|
|
PERF_TALER_MINTDB_NB_DENOMINATION_SAVE),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - denomination loop end",
|
|
|
|
"01 - denomination loop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("01 - init denomination complete"),
|
|
|
|
// End of initialization
|
|
|
|
// Reserve initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
|
|
|
|
PERF_TALER_MINTDB_NB_RESERVE_INIT),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - reserve"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
|
|
|
|
"02 - init reserve loop",
|
|
|
|
"02 - reserve",
|
2015-06-30 18:18:31 +02:00
|
|
|
PERF_TALER_MINTDB_NB_RESERVE_SAVE),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - init reserve end loop",
|
|
|
|
"02 - init reserve loop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("02 - reserve init complete"),
|
2015-07-01 14:11:54 +02:00
|
|
|
// End reserve init"00 - Start of interpreter"),
|
2015-06-30 09:23:04 +02:00
|
|
|
// Withdrawal initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop",
|
|
|
|
PERF_TALER_MINTDB_NB_WITHDRAW_INIT),
|
|
|
|
// PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("03 - start transaction"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
|
|
|
|
"03 - init withdraw loop",
|
|
|
|
"01 - save denomination"),
|
|
|
|
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",
|
|
|
|
"03 - denomination load",
|
|
|
|
"03 - reserve load"),
|
|
|
|
// PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("03 - commit transaction"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - blindcoin array",
|
|
|
|
"03 - init withdraw loop",
|
|
|
|
"03 - withdraw",
|
2015-06-30 18:18:31 +02:00
|
|
|
PERF_TALER_MINTDB_NB_WITHDRAW_SAVE),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - withdraw init end loop",
|
|
|
|
"03 - init withdraw loop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("03 - withdraw init complete"),
|
2015-07-01 14:11:54 +02:00
|
|
|
//End of withdrawal initialization
|
2015-06-30 09:23:04 +02:00
|
|
|
//Deposit initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop",
|
2015-06-24 10:55:57 +02:00
|
|
|
PERF_TALER_MINTDB_NB_DEPOSIT_INIT),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("04 - start transaction"),
|
2015-06-30 18:18:31 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - denomination load",
|
|
|
|
"04 - deposit init loop",
|
|
|
|
"01 - save denomination"),
|
|
|
|
|
2015-07-01 14:11:54 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit",
|
2015-06-30 18:18:31 +02:00
|
|
|
"04 - denomination load"),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("04 - commit transaction"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
|
|
|
|
"04 - deposit init loop",
|
|
|
|
"04 - deposit",
|
2015-06-30 18:18:31 +02:00
|
|
|
PERF_TALER_MINTDB_NB_DEPOSIT_SAVE),
|
2015-06-30 09:23:04 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("04 - deposit init loop end",
|
|
|
|
"04 - deposit init loop"),
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("04 - deposit init complete"),
|
|
|
|
// End of deposit initialization
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_END ("end"),
|
2015-06-11 15:55:46 +02:00
|
|
|
};
|
2015-06-25 15:31:15 +02:00
|
|
|
|
|
|
|
GNUNET_log_setup ("perf-taler-mintdb",
|
2015-06-30 14:01:06 +02:00
|
|
|
"INFO",
|
2015-06-25 15:31:15 +02:00
|
|
|
NULL);
|
2015-07-01 14:11:54 +02:00
|
|
|
config = GNUNET_CONFIGURATION_create ();
|
|
|
|
GNUNET_CONFIGURATION_load (config, "./test-mint-db-postgres.conf");
|
2015-06-12 11:14:32 +02:00
|
|
|
GNUNET_assert (NULL !=
|
|
|
|
(plugin = TALER_MINTDB_plugin_load (config)));
|
|
|
|
plugin->create_tables (plugin->cls, GNUNET_YES);
|
2015-07-01 14:11:54 +02:00
|
|
|
PERF_TALER_MINTDB_interpret (plugin, test);
|
|
|
|
/* Drop tables */
|
2015-06-12 11:14:32 +02:00
|
|
|
{
|
|
|
|
struct TALER_MINTDB_Session *session;
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-12 11:14:32 +02:00
|
|
|
session = plugin->get_session (plugin->cls, GNUNET_YES);
|
|
|
|
plugin->drop_temporary (plugin->cls, session);
|
|
|
|
}
|
2015-07-01 14:11:54 +02:00
|
|
|
TALER_MINTDB_plugin_unload (plugin);
|
|
|
|
GNUNET_CONFIGURATION_destroy (config);
|
|
|
|
return 0;
|
2015-06-09 13:03:37 +02:00
|
|
|
}
|