summaryrefslogtreecommitdiff
path: root/src/benchmark
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-07-25 11:45:14 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-07-25 11:45:14 +0200
commit207c97590234a9ec0c42af960344444f32ee8d27 (patch)
tree9521036f7a204ef362952accef7ecf6987b4fb89 /src/benchmark
parent26c2403f99620540228fcc441424593701d1bfec (diff)
downloadexchange-207c97590234a9ec0c42af960344444f32ee8d27.tar.gz
exchange-207c97590234a9ec0c42af960344444f32ee8d27.tar.bz2
exchange-207c97590234a9ec0c42af960344444f32ee8d27.zip
Benchmark.
Measuring time and print outcome.
Diffstat (limited to 'src/benchmark')
-rw-r--r--src/benchmark/taler-exchange-benchmark-new.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/benchmark/taler-exchange-benchmark-new.c b/src/benchmark/taler-exchange-benchmark-new.c
index df3770cac..9cdd26dbf 100644
--- a/src/benchmark/taler-exchange-benchmark-new.c
+++ b/src/benchmark/taler-exchange-benchmark-new.c
@@ -48,15 +48,10 @@ enum BenchmarkError {
};
/**
- * Probability a coin can be refreshed.
- * This probability multiplied by the number of coins
- * generated during the average refresh must be smaller
- * than one. The variance must be covered by the
- * #INVALID_COIN_SLACK.
+ * Probability that a spent coin will be refreshed.
*/
#define REFRESH_PROBABILITY 0.1
-
/**
* The whole benchmark is a repetition of a "unit". Each
* unit is a array containing a withdraw+deposit operation,
@@ -82,6 +77,18 @@ enum BenchmarkError {
bank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \
USER_LOGIN_NAME, USER_LOGIN_PASS, EXCHANGE_URL)
+
+/**
+ * Time snapshot taken right before executing the CMDs.
+ */
+static struct GNUNET_TIME_Absolute start_time;
+
+/**
+ * Benchmark duration time taken right after the CMD interpreter
+ * returns.
+ */
+static struct GNUNET_TIME_Relative duration;
+
/**
* Exit code.
*/
@@ -93,6 +100,11 @@ static unsigned int result;
static struct GNUNET_OS_Process *bankd;
/**
+ * How many refreshes got executed.
+ */
+static unsigned int howmany_refreshes;
+
+/**
* How many coins we want to create.
*/
static unsigned int howmany_coins = 1;
@@ -258,6 +270,7 @@ run (void *cls,
char *melt_label;
char *reveal_label;
+ howmany_refreshes++;
GNUNET_asprintf (&melt_label,
"refresh-melt-%u",
i);
@@ -293,6 +306,8 @@ run (void *cls,
unit);
}
all_commands[1 + howmany_coins] = TALER_TESTING_cmd_end ();
+
+ start_time = GNUNET_TIME_absolute_get ();
TALER_TESTING_run (is,
all_commands);
result = 1;
@@ -424,7 +439,16 @@ main (int argc,
NULL,
cfg_filename);
+ duration = GNUNET_TIME_absolute_get_duration (start_time);
terminate_process (bankd);
+ TALER_LOG_INFO ("Executed W=%u, D=%u, R=%u, operations in %s\n",
+ howmany_coins,
+ howmany_coins,
+ howmany_refreshes,
+ GNUNET_STRINGS_relative_time_to_string
+ (duration,
+ GNUNET_YES));
+
return (GNUNET_OK == result) ? 0 : result;
}