Benchmark.
Batching all the commands together.
This commit is contained in:
parent
5f0b98a298
commit
9460206749
@ -56,6 +56,14 @@ enum BenchmarkError {
|
|||||||
*/
|
*/
|
||||||
#define REFRESH_PROBABILITY 0.1
|
#define REFRESH_PROBABILITY 0.1
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The whole benchmark is a repetition of a "unit". Each
|
||||||
|
* unit is a array containing a withdraw+deposit operation,
|
||||||
|
* and _possibly_ a refresh of the deposited coin.
|
||||||
|
*/
|
||||||
|
#define UNITY_SIZE 6
|
||||||
|
|
||||||
/* Hard-coded params. Note, the bank is expected to
|
/* Hard-coded params. Note, the bank is expected to
|
||||||
* have the Tor user with account number 3 and password 'x'.
|
* have the Tor user with account number 3 and password 'x'.
|
||||||
*
|
*
|
||||||
@ -162,11 +170,15 @@ static void
|
|||||||
run (void *cls,
|
run (void *cls,
|
||||||
struct TALER_TESTING_Interpreter *is)
|
struct TALER_TESTING_Interpreter *is)
|
||||||
{
|
{
|
||||||
|
#define APIKEY_SANDBOX "Authorization: ApiKey sandbox"
|
||||||
struct TALER_Amount total_reserve_amount;
|
struct TALER_Amount total_reserve_amount;
|
||||||
struct TALER_Amount withdraw_fee;
|
struct TALER_Amount withdraw_fee;
|
||||||
char *withdraw_fee_str;
|
char *withdraw_fee_str;
|
||||||
|
|
||||||
#define APIKEY_SANDBOX "Authorization: ApiKey sandbox"
|
struct TALER_TESTING_Command all_commands
|
||||||
|
[1 + /* Withdraw block */
|
||||||
|
howmany_coins + /* All units */
|
||||||
|
1 /* End CMD */];
|
||||||
|
|
||||||
/* Will be freed by testing-lib. */
|
/* Will be freed by testing-lib. */
|
||||||
GNUNET_assert
|
GNUNET_assert
|
||||||
@ -205,12 +217,13 @@ run (void *cls,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
all_commands[0] = TALER_TESTING_cmd_batch ("make-reserve",
|
||||||
|
make_reserve);
|
||||||
for (unsigned int i = 0; i < howmany_coins; i++)
|
for (unsigned int i = 0; i < howmany_coins; i++)
|
||||||
{
|
{
|
||||||
#define UNITY_SIZE 6
|
|
||||||
char *withdraw_label;
|
char *withdraw_label;
|
||||||
char *order_enc;
|
char *order_enc;
|
||||||
struct TALER_TESTING_Command unity[UNITY_SIZE];
|
struct TALER_TESTING_Command unit[UNITY_SIZE];
|
||||||
|
|
||||||
GNUNET_asprintf (&withdraw_label,
|
GNUNET_asprintf (&withdraw_label,
|
||||||
"withdraw-%u",
|
"withdraw-%u",
|
||||||
@ -220,14 +233,14 @@ run (void *cls,
|
|||||||
"{\"nonce\": %u}",
|
"{\"nonce\": %u}",
|
||||||
i);
|
i);
|
||||||
|
|
||||||
unity[0] = TALER_TESTING_cmd_withdraw_amount
|
unit[0] = TALER_TESTING_cmd_withdraw_amount
|
||||||
(withdraw_label,
|
(withdraw_label,
|
||||||
is->exchange,
|
is->exchange,
|
||||||
"create-reserve",
|
"create-reserve",
|
||||||
AMOUNT_5,
|
AMOUNT_5,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unity[1] = TALER_TESTING_cmd_deposit
|
unit[1] = TALER_TESTING_cmd_deposit
|
||||||
("deposit",
|
("deposit",
|
||||||
is->exchange,
|
is->exchange,
|
||||||
withdraw_label,
|
withdraw_label,
|
||||||
@ -245,7 +258,6 @@ run (void *cls,
|
|||||||
char *melt_label;
|
char *melt_label;
|
||||||
char *reveal_label;
|
char *reveal_label;
|
||||||
|
|
||||||
|
|
||||||
GNUNET_asprintf (&melt_label,
|
GNUNET_asprintf (&melt_label,
|
||||||
"refresh-melt-%u",
|
"refresh-melt-%u",
|
||||||
i);
|
i);
|
||||||
@ -254,55 +266,33 @@ run (void *cls,
|
|||||||
"refresh-reveal-%u",
|
"refresh-reveal-%u",
|
||||||
i);
|
i);
|
||||||
|
|
||||||
unity[2] = TALER_TESTING_cmd_refresh_melt
|
unit[2] = TALER_TESTING_cmd_refresh_melt
|
||||||
(melt_label,
|
(melt_label,
|
||||||
is->exchange,
|
is->exchange,
|
||||||
AMOUNT_4,
|
AMOUNT_4,
|
||||||
withdraw_label,
|
withdraw_label,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unity[3] = TALER_TESTING_cmd_refresh_reveal
|
unit[3] = TALER_TESTING_cmd_refresh_reveal
|
||||||
(reveal_label,
|
(reveal_label,
|
||||||
is->exchange,
|
is->exchange,
|
||||||
melt_label,
|
melt_label,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unity[4] = TALER_TESTING_cmd_refresh_link
|
unit[4] = TALER_TESTING_cmd_refresh_link
|
||||||
("refresh-link",
|
("refresh-link",
|
||||||
is->exchange,
|
is->exchange,
|
||||||
reveal_label,
|
reveal_label,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unity[5] = TALER_TESTING_cmd_end ();
|
unit[5] = TALER_TESTING_cmd_end ();
|
||||||
}
|
}
|
||||||
else unity[2] = TALER_TESTING_cmd_end ();
|
else unit[2] = TALER_TESTING_cmd_end ();
|
||||||
|
|
||||||
|
all_commands[1 + i] = TALER_TESTING_cmd_batch ("unit",
|
||||||
|
unit);
|
||||||
}
|
}
|
||||||
|
all_commands[1 + howmany_coins] = TALER_TESTING_cmd_end ();
|
||||||
struct TALER_TESTING_Command all_commands[] = {
|
|
||||||
TALER_TESTING_cmd_batch ("make-reserve",
|
|
||||||
make_reserve),
|
|
||||||
TALER_TESTING_cmd_end ()
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
TALER_TESTING_cmd_withdraw_amount
|
|
||||||
("withdraw-coin-1",
|
|
||||||
is->exchange, // picks port from config's [exchange].
|
|
||||||
"create-reserve-1",
|
|
||||||
CURRENCY_5,
|
|
||||||
MHD_HTTP_OK),
|
|
||||||
|
|
||||||
TALER_TESTING_cmd_withdraw_amount
|
|
||||||
("withdraw-coin-2",
|
|
||||||
is->exchange,
|
|
||||||
"create-reserve-1",
|
|
||||||
CURRENCY_5,
|
|
||||||
MHD_HTTP_OK),
|
|
||||||
|
|
||||||
TALER_TESTING_cmd_end ()
|
|
||||||
}; */
|
|
||||||
|
|
||||||
TALER_TESTING_run (is,
|
TALER_TESTING_run (is,
|
||||||
all_commands);
|
all_commands);
|
||||||
result = 1;
|
result = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user