summaryrefslogtreecommitdiff
path: root/src/mintdb/perf_taler_mintdb_interpreter.c
diff options
context:
space:
mode:
authorFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-07-17 16:23:12 +0200
committerFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-07-17 16:23:12 +0200
commitcb37f25146d5c98cd7b4498db9fc14d181cf4fe3 (patch)
tree43446b66c32b7928762c8d28e37ca21779009be9 /src/mintdb/perf_taler_mintdb_interpreter.c
parent0e69c33d1f2591673887a5fa4d293e6df7431c0f (diff)
downloadexchange-cb37f25146d5c98cd7b4498db9fc14d181cf4fe3.tar.gz
exchange-cb37f25146d5c98cd7b4498db9fc14d181cf4fe3.tar.bz2
exchange-cb37f25146d5c98cd7b4498db9fc14d181cf4fe3.zip
timing reworked
Diffstat (limited to 'src/mintdb/perf_taler_mintdb_interpreter.c')
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index 89e4c3f62..e9ee05e33 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -61,6 +61,13 @@ data_free (struct PERF_TALER_MINTDB_Data *data)
{
switch (data->type)
{
+ case PERF_TALER_MINTDB_TIME:
+ if (NULL == data->data.time)
+ return;
+ GNUNET_free (data->data.time);
+ data->data.time = NULL;
+ return;
+
case PERF_TALER_MINTDB_DEPOSIT:
if (NULL == data->data.deposit)
return;
@@ -112,7 +119,8 @@ data_copy (const struct PERF_TALER_MINTDB_Data *data, struct PERF_TALER_MINTDB_D
switch (data->type)
{
case PERF_TALER_MINTDB_TIME:
- copy->data.time = data->data.time;
+ copy->data.time = GNUNET_new (struct GNUNET_TIME_Absolute);
+ *copy->data.time = *data->data.time;
return;
case PERF_TALER_MINTDB_DEPOSIT:
@@ -437,15 +445,18 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
break;
case PERF_TALER_MINTDB_CMD_GET_TIME:
- clock_gettime (CLOCK_MONOTONIC, &state->cmd[state->i].exposed.data.time);
+ state->cmd[state->i].exposed.data.time =
+ GNUNET_new (struct GNUNET_TIME_Absolute);
+ *state->cmd[state->i].exposed.data.time =
+ GNUNET_TIME_absolute_get ();
break;
case PERF_TALER_MINTDB_CMD_GAUGER:
{
int start_index, stop_index;
- struct timespec start, stop;
- unsigned long elapsed_ms;
-
+ float ips;
+ struct GNUNET_TIME_Absolute start, stop;
+ struct GNUNET_TIME_Relative elapsed;
GNUNET_assert (GNUNET_SYSERR !=
(start_index = cmd_find (state->cmd,
state->cmd[state->i]
@@ -454,14 +465,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
(stop_index = cmd_find (state->cmd,
state->cmd[state->i]
.details.gauger.label_stop)));
- start = state->cmd[start_index].exposed.data.time;
- stop = state->cmd[stop_index].exposed.data.time;
- elapsed_ms = (start.tv_sec - stop.tv_sec) * 1000 +
- (start.tv_nsec - stop.tv_nsec) / 1000000;
-
+ start = *state->cmd[start_index].exposed.data.time;
+ stop = *state->cmd[stop_index].exposed.data.time;
+ elapsed = GNUNET_TIME_absolute_get_difference (start,
+ stop);
+ ips = (1.0 * state->cmd[state->i].details.gauger.divide) / (elapsed.rel_value_us/1000000.0);
+ printf ("gauger data:%lu - %f\n", elapsed.rel_value_us, ips);
GAUGER ("MINTDB",
state->cmd[state->i].details.gauger.description,
- ((1.0 * state->cmd[state->i].details.gauger.divide) / elapsed_ms) * 1000,
+ ips,
state->cmd[state->i].details.gauger.unit);
}
break;