Commit 290bd602 by Ismael

Refactor for pull request

parent 2e5c397b
...@@ -16,6 +16,7 @@ Eugene Zhuk <eugene.zhuk@gmail.com> ...@@ -16,6 +16,7 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com> Evgeny Safronov <division494@gmail.com>
Felix Homann <linuxaudio@showlabor.de> Felix Homann <linuxaudio@showlabor.de>
Google Inc. Google Inc.
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
JianXiong Zhou <zhoujianxiong2@gmail.com> JianXiong Zhou <zhoujianxiong2@gmail.com>
Jussi Knuuttila <jussi.knuuttila@gmail.com> Jussi Knuuttila <jussi.knuuttila@gmail.com>
Kaito Udagawa <umireon@gmail.com> Kaito Udagawa <umireon@gmail.com>
......
...@@ -31,6 +31,7 @@ Dominic Hamon <dma@stripysock.com> ...@@ -31,6 +31,7 @@ Dominic Hamon <dma@stripysock.com>
Eugene Zhuk <eugene.zhuk@gmail.com> Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com> Evgeny Safronov <division494@gmail.com>
Felix Homann <linuxaudio@showlabor.de> Felix Homann <linuxaudio@showlabor.de>
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
JianXiong Zhou <zhoujianxiong2@gmail.com> JianXiong Zhou <zhoujianxiong2@gmail.com>
Jussi Knuuttila <jussi.knuuttila@gmail.com> Jussi Knuuttila <jussi.knuuttila@gmail.com>
Kaito Udagawa <umireon@gmail.com> Kaito Udagawa <umireon@gmail.com>
......
...@@ -232,7 +232,8 @@ enum TimeUnit { ...@@ -232,7 +232,8 @@ enum TimeUnit {
}; };
// BigO is passed to a benchmark in order to specify the asymptotic computational // BigO is passed to a benchmark in order to specify the asymptotic computational
// complexity for the benchmark. // complexity for the benchmark. In case O_Auto is selected, complexity will be
// calculated automatically to the best fit.
enum BigO { enum BigO {
O_None, O_None,
O_1, O_1,
...@@ -479,8 +480,8 @@ public: ...@@ -479,8 +480,8 @@ public:
// or MB/second values. // or MB/second values.
Benchmark* UseManualTime(); Benchmark* UseManualTime();
// Set the asymptotic computational complexity for the benchmark. This option // Set the asymptotic computational complexity for the benchmark. If called
// called the asymptotic computational complexity will be shown on the output. // the asymptotic computational complexity will be shown on the output.
Benchmark* Complexity(BigO complexity); Benchmark* Complexity(BigO complexity);
// Support for running multiple copies of the same benchmark concurrently // Support for running multiple copies of the same benchmark concurrently
......
...@@ -74,7 +74,7 @@ class BenchmarkReporter { ...@@ -74,7 +74,7 @@ class BenchmarkReporter {
int arg1; int arg1;
int arg2; int arg2;
// Inform print function if the current run is a complexity report // Inform print function whether the current run is a complexity report
bool report_bigO; bool report_bigO;
bool report_rms; bool report_rms;
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
// Source project : https://github.com/ismaelJimenez/cpp.leastsq // Source project : https://github.com/ismaelJimenez/cpp.leastsq
// Addapted to be used with google benchmark // Adapted to be used with google benchmark
#include "minimal_leastsq.h" #include "minimal_leastsq.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
// Source project : https://github.com/ismaelJimenez/cpp.leastsq // Source project : https://github.com/ismaelJimenez/cpp.leastsq
// Addapted to be used with google benchmark // Adapted to be used with google benchmark
#if !defined(MINIMAL_LEASTSQ_H_) #if !defined(MINIMAL_LEASTSQ_H_)
#define MINIMAL_LEASTSQ_H_ #define MINIMAL_LEASTSQ_H_
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <vector> #include <vector>
// This data structure will contain the result returned vy minimalLeastSq // This data structure will contain the result returned by minimalLeastSq
// - coef : Estimated coeficient for the high-order term as interpolated from data. // - coef : Estimated coeficient for the high-order term as interpolated from data.
// - rms : Normalized Root Mean Squared Error. // - rms : Normalized Root Mean Squared Error.
// - complexity : Scalability form (e.g. O_N, O_N_log_N). In case a scalability form has been provided to minimalLeastSq // - complexity : Scalability form (e.g. O_N, O_N_log_N). In case a scalability form has been provided to minimalLeastSq
......
...@@ -89,7 +89,7 @@ void BenchmarkReporter::ComputeBigO( ...@@ -89,7 +89,7 @@ void BenchmarkReporter::ComputeBigO(
std::vector<double> CpuTime; std::vector<double> CpuTime;
// Populate the accumulators. // Populate the accumulators.
for (Run const& run : reports) { for (const Run& run : reports) {
N.push_back(run.arg1); N.push_back(run.arg1);
RealTime.push_back(run.real_accumulated_time/run.iterations); RealTime.push_back(run.real_accumulated_time/run.iterations);
CpuTime.push_back(run.cpu_accumulated_time/run.iterations); CpuTime.push_back(run.cpu_accumulated_time/run.iterations);
......
...@@ -36,8 +36,8 @@ static void BM_Complexity_O_N(benchmark::State& state) { ...@@ -36,8 +36,8 @@ static void BM_Complexity_O_N(benchmark::State& state) {
benchmark::DoNotOptimize(std::find(v.begin(), v.end(), itemNotInVector)); benchmark::DoNotOptimize(std::find(v.begin(), v.end(), itemNotInVector));
} }
} }
BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2)->Range(1<<10, 1<<16) -> Complexity(benchmark::O_N); BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::O_N);
BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2)->Range(1<<10, 1<<16) -> Complexity(benchmark::O_Auto); BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::O_Auto);
static void BM_Complexity_O_N_Squared(benchmark::State& state) { static void BM_Complexity_O_N_Squared(benchmark::State& state) {
std::string s1(state.range_x(), '-'); std::string s1(state.range_x(), '-');
...@@ -77,7 +77,7 @@ static void BM_Complexity_O_log_N(benchmark::State& state) { ...@@ -77,7 +77,7 @@ static void BM_Complexity_O_log_N(benchmark::State& state) {
} }
} }
BENCHMARK(BM_Complexity_O_log_N) BENCHMARK(BM_Complexity_O_log_N)
->RangeMultiplier(2)->Range(1<<10, 1<<16) -> Complexity(benchmark::O_log_N); -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::O_log_N);
static void BM_Complexity_O_N_log_N(benchmark::State& state) { static void BM_Complexity_O_N_log_N(benchmark::State& state) {
auto v = ConstructRandomVector(state.range_x()); auto v = ConstructRandomVector(state.range_x());
...@@ -85,8 +85,8 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) { ...@@ -85,8 +85,8 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) {
std::sort(v.begin(), v.end()); std::sort(v.begin(), v.end());
} }
} }
BENCHMARK(BM_Complexity_O_N_log_N) ->RangeMultiplier(2)->Range(1<<10, 1<<16) -> Complexity(benchmark::O_N_log_N); BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::O_N_log_N);
BENCHMARK(BM_Complexity_O_N_log_N) ->RangeMultiplier(2)->Range(1<<10, 1<<16) -> Complexity(benchmark::O_Auto); BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::O_Auto);
// Test benchmark with no range and check no complexity is calculated. // Test benchmark with no range and check no complexity is calculated.
void BM_Extreme_Cases(benchmark::State& state) { void BM_Extreme_Cases(benchmark::State& state) {
...@@ -94,6 +94,6 @@ void BM_Extreme_Cases(benchmark::State& state) { ...@@ -94,6 +94,6 @@ void BM_Extreme_Cases(benchmark::State& state) {
} }
} }
BENCHMARK(BM_Extreme_Cases) -> Complexity(benchmark::O_N_log_N); BENCHMARK(BM_Extreme_Cases) -> Complexity(benchmark::O_N_log_N);
BENCHMARK(BM_Extreme_Cases)->Arg(42) -> Complexity(benchmark::O_Auto); BENCHMARK(BM_Extreme_Cases) -> Arg(42) -> Complexity(benchmark::O_Auto);
BENCHMARK_MAIN() BENCHMARK_MAIN()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment