fixed gauger command in the interpreter

This commit is contained in:
Fournier Nicolas 2015-06-24 10:55:57 +02:00
parent 6108acb923
commit e2ab079dd8
4 changed files with 77 additions and 52 deletions

View File

@ -33,30 +33,41 @@ main (int argc, char ** argv)
struct GNUNET_CONFIGURATION_Handle *config; struct GNUNET_CONFIGURATION_Handle *config;
struct PERF_TALER_MINTDB_Cmd test[] = struct PERF_TALER_MINTDB_Cmd test[] =
{ {
PERF_TALER_MINTDB_INIT_CMD_LOOP ("loop_db_init_deposit",10000), PERF_TALER_MINTDB_INIT_CMD_LOOP ("loop_db_init_deposit",
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("start_transaction_init"), PERF_TALER_MINTDB_NB_DEPOSIT_INIT),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("init_deposit_insert"), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("start_transaction_init"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("commit_transaction_init"), PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("init_deposit_insert"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("array_depo", PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("commit_transaction_init"),
"loop_db_init_deposit", PERF_TALER_MINTDB_INIT_CMD_DEBUG("INIT_LOOP"),
"init_deposit_insert", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("array_depo",
100, "loop_db_init_deposit",
PERF_TALER_MINTDB_DEPOSIT), "init_deposit_insert",
PERF_TALER_MINTDB_NB_DEPOSIT_GET,
PERF_TALER_MINTDB_DEPOSIT),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("endloop_init_deposit", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("endloop_init_deposit",
"loop_db_init_deposit"), "loop_db_init_deposit"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG("Fin loop 1"), PERF_TALER_MINTDB_INIT_CMD_DEBUG("INIT_END"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("loop_deposit_get",100), // End of database initialization
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("start_transaction_get"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("deposit_get_start"),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY("load deposit", PERF_TALER_MINTDB_INIT_CMD_LOOP ("loop_deposit_get",
"loop_deposit_get", PERF_TALER_MINTDB_NB_DEPOSIT_GET),
"array_depo"), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("start_transaction_get"),
PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT("get_deposit", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("load deposit",
"load_deposit"), "loop_deposit_get",
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("commit_transaction_init"), "array_depo"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP("stop2", "loop_deposit_get"), PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT ("get_deposit",
PERF_TALER_MINTDB_INIT_CMD_END("end") "load_deposit"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("commit_transaction_init"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("stop2", "loop_deposit_get"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("deposit_get_end"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("deposit_get_commit",
"deposit_get_start",
"deposit_get_end",
"time per deposit check",
PERF_TALER_MINTDB_NB_DEPOSIT_GET),
PERF_TALER_MINTDB_INIT_CMD_END("end"),
}; };
// Plugin init // Plugin init
config = GNUNET_CONFIGURATION_create(); config = GNUNET_CONFIGURATION_create();
GNUNET_CONFIGURATION_load(config, "./test-mint-db-postgres.conf"); GNUNET_CONFIGURATION_load(config, "./test-mint-db-postgres.conf");
GNUNET_assert (NULL != GNUNET_assert (NULL !=

View File

@ -407,7 +407,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
GAUGER ("MINTDB", GAUGER ("MINTDB",
state->cmd[state->i].details.gauger.description, state->cmd[state->i].details.gauger.description,
elapsed_ms, elapsed_ms / state->cmd[state->i].details.gauger.divide,
"milliseconds"); "milliseconds");
} }
break; break;

View File

@ -58,7 +58,7 @@
.exposed_type = PERF_TALER_MINTDB_NONE , \ .exposed_type = PERF_TALER_MINTDB_NONE , \
.details.loop = { \ .details.loop = { \
.max_iterations = _iter , \ .max_iterations = _iter , \
.curr_iteration = 0} \ .curr_iteration = 0 } \
} }
/** /**
@ -86,15 +86,16 @@
* Commits the duration between @a _label_start and @a _label_stop * Commits the duration between @a _label_start and @a _label_stop
* to Gauger with @a _description explaining * to Gauger with @a _description explaining
*/ */
#define PERF_TALER_MINTDB_INIT_CMD_GAUGER(_label, _start_time, _stop_time, _description) \ #define PERF_TALER_MINTDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, _description, _divide) \
{ \ { \
.command = PERF_TALER_MINTDB_CMD_GAUGER, \ .command = PERF_TALER_MINTDB_CMD_GAUGER, \
.label = _label, \ .label = _label, \
.exposed_type = PERF_TALER_MINTDB_NONE, \ .exposed_type = PERF_TALER_MINTDB_NONE, \
.details.gauger = { \ .details.gauger = { \
.label_start = _label_start, \ .label_start = _label_start, \
.label_end = _label_end, \ .label_stop = _label_stop, \
.description = _description \ .description = _description, \
.divide = _divide, \
} \ } \
} }
@ -249,9 +250,7 @@ enum PERF_TALER_MINTDB_Type
PERF_TALER_MINTDB_TIME, PERF_TALER_MINTDB_TIME,
PERF_TALER_MINTDB_DEPOSIT, PERF_TALER_MINTDB_DEPOSIT,
PERF_TALER_MINTDB_BLINDCOIN, PERF_TALER_MINTDB_BLINDCOIN,
PERF_TALER_MINTDB_RESERVE_KEY,
PERF_TALER_MINTDB_RESERVE, PERF_TALER_MINTDB_RESERVE,
PERF_TALER_MINTDB_DENOMINATION_KEY,
PERF_TALER_MINTDB_DENOMINATION_INFO, PERF_TALER_MINTDB_DENOMINATION_INFO,
PERF_TALER_MINTDB_COIN_INFO, PERF_TALER_MINTDB_COIN_INFO,
}; };
@ -266,7 +265,6 @@ union PERF_TALER_MINTDB_Data
struct TALER_MINTDB_Deposit *deposit; struct TALER_MINTDB_Deposit *deposit;
struct TALER_MINTDB_CollectableBlindcoin *blindcoin; struct TALER_MINTDB_CollectableBlindcoin *blindcoin;
struct TALER_MINTDB_Reserve *reserve; struct TALER_MINTDB_Reserve *reserve;
struct TALER_DenominationPublicKey *dpk;
struct TALER_MINTDB_DenominationKeyIssueInformation *dki; struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TALER_CoinPublicInfo *cpi; struct TALER_CoinPublicInfo *cpi;
}; };
@ -334,8 +332,11 @@ enum PERF_TALER_MINTDB_CMD_Name
// Insert informations about a denomination key in the database // Insert informations about a denomination key in the database
PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION, PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION,
// polls the database for informations about a specific denomination key // Polls the database for informations about a specific denomination key
PERF_TALER_MINTDB_CMD_GET_DENOMINATION PERF_TALER_MINTDB_CMD_GET_DENOMINATION,
// Refresh a coin
PERF_TALER_MINTDB_CMD_REFRESH_COIN,
}; };
@ -381,6 +382,12 @@ struct PERF_TALER_MINTDB_CMD_gauger_details
* Description of the metric, used in GAUGER * Description of the metric, used in GAUGER
*/ */
const char *description; const char *description;
/**
* Constant the result needs to be divided by
* to get the result per unit
*/
float divide;
}; };
@ -470,6 +477,19 @@ struct PERF_TALER_MINTDB_CMD_get_denomination_details
const char *label_source; const char *label_source;
}; };
/**
* Extra data requiered for refreshing coins
*/
struct PERF_TALER_MINTDB_CMD_refresh_coin_details
{
/**
* The label of the coin to refresh
*/
const char *label_source;
};
/** /**
* Contains extra data required for any command * Contains extra data required for any command
*/ */
@ -483,6 +503,7 @@ union PERF_TALER_MINTDB_CMD_Details
struct PERF_TALER_MINTDB_CMD_get_deposit_details get_deposit; struct PERF_TALER_MINTDB_CMD_get_deposit_details get_deposit;
struct PERF_TALER_MINTDB_CMD_get_reserve_details get_reserve; struct PERF_TALER_MINTDB_CMD_get_reserve_details get_reserve;
struct PERF_TALER_MINTDB_CMD_get_denomination_details get_denomination; struct PERF_TALER_MINTDB_CMD_get_denomination_details get_denomination;
struct PERF_TALER_MINTDB_CMD_refresh_coin_details refresh;
}; };
@ -520,7 +541,7 @@ struct PERF_TALER_MINTDB_Cmd
* GNUNET_YES if the exposed value hav been saved during last loop iteration * GNUNET_YES if the exposed value hav been saved during last loop iteration
* GNUNET_NO if it hasn't * GNUNET_NO if it hasn't
*/ */
int exposed_saved; unsigned int exposed_saved;
}; };
@ -533,5 +554,4 @@ PERF_TALER_MINTDB_interpret(
struct TALER_MINTDB_Plugin *db_plugin, struct TALER_MINTDB_Plugin *db_plugin,
struct PERF_TALER_MINTDB_Cmd cmd[]); struct PERF_TALER_MINTDB_Cmd cmd[]);
#endif #endif

View File

@ -1,18 +1,18 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors) Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
TALER is free software; you can redistribute it and/or modify it under the 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 terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version. 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 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 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 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/> TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file mintdb/perf_taler_mintdb_values.h * @file mintdb/perf_taler_mintdb_values.h
* @brief Values for tweaking the performance analysis * @brief Values for tweaking the performance analysis
@ -23,15 +23,9 @@
#define NB_DEPOSIT_INIT 100000 #define PERF_TALER_MINTDB_NB_DEPOSIT_INIT 100
#define NB_DEPOSIT_GET 1000 #define PERF_TALER_MINTDB_NB_DEPOSIT_GET 10
#define NB_DEPOSIT_MARGIN 10000
#define NB_BLINDCOIN_INIT 100000
// Temporary macro to compile
#define GAUGER(a,b,c,d)
#endif #endif