Refactor for pull request

This commit is contained in:
Ismael 2016-05-21 11:51:42 +02:00
parent 2e5c397b48
commit 290bd60289
8 changed files with 18 additions and 15 deletions

View File

@ -16,6 +16,7 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com>
Felix Homann <linuxaudio@showlabor.de>
Google Inc.
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
JianXiong Zhou <zhoujianxiong2@gmail.com>
Jussi Knuuttila <jussi.knuuttila@gmail.com>
Kaito Udagawa <umireon@gmail.com>

View File

@ -31,6 +31,7 @@ Dominic Hamon <dma@stripysock.com>
Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com>
Felix Homann <linuxaudio@showlabor.de>
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
JianXiong Zhou <zhoujianxiong2@gmail.com>
Jussi Knuuttila <jussi.knuuttila@gmail.com>
Kaito Udagawa <umireon@gmail.com>

View File

@ -232,7 +232,8 @@ enum TimeUnit {
};
// 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 {
O_None,
O_1,
@ -479,8 +480,8 @@ public:
// or MB/second values.
Benchmark* UseManualTime();
// Set the asymptotic computational complexity for the benchmark. This option
// called the asymptotic computational complexity will be shown on the output.
// Set the asymptotic computational complexity for the benchmark. If called
// the asymptotic computational complexity will be shown on the output.
Benchmark* Complexity(BigO complexity);
// Support for running multiple copies of the same benchmark concurrently

View File

@ -74,7 +74,7 @@ class BenchmarkReporter {
int arg1;
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_rms;
};

View File

@ -13,7 +13,7 @@
// limitations under the License.
// 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"

View File

@ -13,7 +13,7 @@
// limitations under the License.
// 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_)
#define MINIMAL_LEASTSQ_H_
@ -22,7 +22,7 @@
#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.
// - 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

View File

@ -85,11 +85,11 @@ void BenchmarkReporter::ComputeBigO(
CHECK(reports.size() >= 2) << "Cannot compute asymptotic complexity for less than 2 reports";
// Accumulators.
std::vector<int> N;
std::vector<double> RealTime;
std::vector<double> RealTime;
std::vector<double> CpuTime;
// Populate the accumulators.
for (Run const& run : reports) {
for (const Run& run : reports) {
N.push_back(run.arg1);
RealTime.push_back(run.real_accumulated_time/run.iterations);
CpuTime.push_back(run.cpu_accumulated_time/run.iterations);

View File

@ -36,8 +36,8 @@ static void BM_Complexity_O_N(benchmark::State& state) {
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_Auto);
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);
static void BM_Complexity_O_N_Squared(benchmark::State& state) {
std::string s1(state.range_x(), '-');
@ -77,7 +77,7 @@ static void BM_Complexity_O_log_N(benchmark::State& state) {
}
}
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) {
auto v = ConstructRandomVector(state.range_x());
@ -85,8 +85,8 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) {
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_Auto);
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);
// Test benchmark with no range and check no complexity is calculated.
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)->Arg(42) -> Complexity(benchmark::O_Auto);
BENCHMARK(BM_Extreme_Cases) -> Arg(42) -> Complexity(benchmark::O_Auto);
BENCHMARK_MAIN()