diff options
author | MarcoFalke <falke.marco@gmail.com> | 2017-01-05 11:31:56 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-01-05 11:32:05 +0100 |
commit | 4cfd57d2e38207d78722ce8c9274ba8dd700d1cc (patch) | |
tree | bf92932a6f870b3d44f24c4c5f214518cd63d258 /src/bench | |
parent | 406f35d99d0fcd2f50370280e605283d04da466a (diff) | |
parent | 73f41190b91dce9c125b1828b18f7625e0200145 (diff) |
Merge #9281: Refactor: Remove using namespace <xxx> from bench/ & test/ sources
73f4119 Refactoring: Removed using namespace <xxx> from bench/ and test/ source files. (Karl-Johan Alm)
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/bench.cpp | 14 | ||||
-rw-r--r-- | src/bench/coin_selection.cpp | 8 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index aa9dfef577..1bd9d06b80 100644 --- a/src/bench/bench.cpp +++ b/src/bench/bench.cpp @@ -9,9 +9,7 @@ #include <iomanip> #include <sys/time.h> -using namespace benchmark; - -std::map<std::string, BenchFunction> BenchRunner::benchmarks; +std::map<std::string, benchmark::BenchFunction> benchmark::BenchRunner::benchmarks; static double gettimedouble(void) { struct timeval tv; @@ -19,29 +17,29 @@ static double gettimedouble(void) { return tv.tv_usec * 0.000001 + tv.tv_sec; } -BenchRunner::BenchRunner(std::string name, BenchFunction func) +benchmark::BenchRunner::BenchRunner(std::string name, benchmark::BenchFunction func) { benchmarks.insert(std::make_pair(name, func)); } void -BenchRunner::RunAll(double elapsedTimeForOne) +benchmark::BenchRunner::RunAll(double elapsedTimeForOne) { perf_init(); std::cout << "#Benchmark" << "," << "count" << "," << "min" << "," << "max" << "," << "average" << "," << "min_cycles" << "," << "max_cycles" << "," << "average_cycles" << "\n"; - for (std::map<std::string,BenchFunction>::iterator it = benchmarks.begin(); + for (std::map<std::string,benchmark::BenchFunction>::iterator it = benchmarks.begin(); it != benchmarks.end(); ++it) { State state(it->first, elapsedTimeForOne); - BenchFunction& func = it->second; + benchmark::BenchFunction& func = it->second; func(state); } perf_fini(); } -bool State::KeepRunning() +bool benchmark::State::KeepRunning() { if (count & countMask) { ++count; diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index c961151f53..29fbd34631 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -8,9 +8,7 @@ #include <boost/foreach.hpp> #include <set> -using namespace std; - -static void addCoin(const CAmount& nValue, const CWallet& wallet, vector<COutput>& vCoins) +static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector<COutput>& vCoins) { int nInput = 0; @@ -36,7 +34,7 @@ static void addCoin(const CAmount& nValue, const CWallet& wallet, vector<COutput static void CoinSelection(benchmark::State& state) { const CWallet wallet; - vector<COutput> vCoins; + std::vector<COutput> vCoins; LOCK(wallet.cs_wallet); while (state.KeepRunning()) { @@ -50,7 +48,7 @@ static void CoinSelection(benchmark::State& state) addCoin(1000 * COIN, wallet, vCoins); addCoin(3 * COIN, wallet, vCoins); - set<pair<const CWalletTx*, unsigned int> > setCoinsRet; + std::set<std::pair<const CWalletTx*, unsigned int> > setCoinsRet; CAmount nValueRet; bool success = wallet.SelectCoinsMinConf(1003 * COIN, 1, 6, 0, vCoins, setCoinsRet, nValueRet); assert(success); |