Auto merge of #2650 - str4d:2645-listunspent-benchmark, r=str4d
Add benchmark for listunspent Closes #2645.
This commit is contained in:
commit
af549fe6ed
|
@ -56,7 +56,7 @@ function use_200k_benchmark {
|
||||||
|
|
||||||
function zcashd_start {
|
function zcashd_start {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
sendtoaddress|loadwallet)
|
sendtoaddress|loadwallet|listunspent)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
200k-recv)
|
200k-recv)
|
||||||
use_200k_benchmark 0
|
use_200k_benchmark 0
|
||||||
|
@ -86,7 +86,7 @@ function zcashd_stop {
|
||||||
|
|
||||||
function zcashd_massif_start {
|
function zcashd_massif_start {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
sendtoaddress|loadwallet)
|
sendtoaddress|loadwallet|listunspent)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
200k-recv)
|
200k-recv)
|
||||||
use_200k_benchmark 0
|
use_200k_benchmark 0
|
||||||
|
@ -206,6 +206,9 @@ case "$1" in
|
||||||
loadwallet)
|
loadwallet)
|
||||||
zcash_rpc zcbenchmark loadwallet 10
|
zcash_rpc zcbenchmark loadwallet 10
|
||||||
;;
|
;;
|
||||||
|
listunspent)
|
||||||
|
zcash_rpc zcbenchmark listunspent 10
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
zcashd_stop
|
zcashd_stop
|
||||||
echo "Bad arguments to time."
|
echo "Bad arguments to time."
|
||||||
|
@ -253,6 +256,9 @@ case "$1" in
|
||||||
loadwallet)
|
loadwallet)
|
||||||
# The initial load is sufficient for measurement
|
# The initial load is sufficient for measurement
|
||||||
;;
|
;;
|
||||||
|
listunspent)
|
||||||
|
zcash_rpc zcbenchmark listunspent 1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
zcashd_massif_stop
|
zcashd_massif_stop
|
||||||
echo "Bad arguments to memory."
|
echo "Bad arguments to memory."
|
||||||
|
|
|
@ -2609,6 +2609,8 @@ UniValue zc_benchmark(const UniValue& params, bool fHelp)
|
||||||
throw JSONRPCError(RPC_TYPE_ERROR, "Benchmark must be run in regtest mode");
|
throw JSONRPCError(RPC_TYPE_ERROR, "Benchmark must be run in regtest mode");
|
||||||
}
|
}
|
||||||
sample_times.push_back(benchmark_loadwallet());
|
sample_times.push_back(benchmark_loadwallet());
|
||||||
|
} else if (benchmarktype == "listunspent") {
|
||||||
|
sample_times.push_back(benchmark_listunspent());
|
||||||
} else {
|
} else {
|
||||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid benchmarktype");
|
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid benchmarktype");
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,3 +465,12 @@ double benchmark_loadwallet()
|
||||||
post_wallet_load();
|
post_wallet_load();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double benchmark_listunspent()
|
||||||
|
{
|
||||||
|
UniValue params(UniValue::VARR);
|
||||||
|
struct timeval tv_start;
|
||||||
|
timer_start(tv_start);
|
||||||
|
auto unspent = listunspent(params, false);
|
||||||
|
return timer_stop(tv_start);
|
||||||
|
}
|
||||||
|
|
|
@ -18,5 +18,6 @@ extern double benchmark_increment_note_witnesses(size_t nTxs);
|
||||||
extern double benchmark_connectblock_slow();
|
extern double benchmark_connectblock_slow();
|
||||||
extern double benchmark_sendtoaddress(CAmount amount);
|
extern double benchmark_sendtoaddress(CAmount amount);
|
||||||
extern double benchmark_loadwallet();
|
extern double benchmark_loadwallet();
|
||||||
|
extern double benchmark_listunspent();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue