Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <benchmark.h>
Classes | |
struct | BenchmarkResult |
Public Types | |
typedef void(* | BenchmarkFunction )(int iters, void *) |
Public Member Functions | |
Benchmark (const std::string &name) | |
Name of the microbenchmark. This is outputted in the result. More... | |
int | AddBenchmark (const std::string &name, BenchmarkFunction fn, void *args, int baseline_idx=0) |
std::string | Measure () |
Runs all the benchmarks and returns the result in a formatted string. More... | |
Static Public Member Functions | |
static std::string | GetMachineInfo () |
Output machine/build configuration as a string. More... | |
Static Private Member Functions | |
static double | Measure (BenchmarkFunction function, void *args, int max_time=1000, int initial_batch_size=1000) |
Private Attributes | |
std::string | name_ |
std::vector< BenchmarkResult > | benchmarks_ |
Friends | |
class | BenchmarkTest |
Utility class for microbenchmarks. This can be utilized to create a benchmark suite. For example: Benchmark suite("benchmark"); suite.AddBenchmark("Implementation #1", Implementation1Fn, data); suite.AddBenchmark("Implementation #2", Implementation2Fn, data); ... string result = suite.Measure();
Definition at line 31 of file benchmark.h.
typedef void(* impala::Benchmark::BenchmarkFunction)(int iters, void *) |
Function to benchmark. The function should run iters time (to minimize function call overhead). The second argument is opaque and is whatever data the test function needs to execute.
Definition at line 39 of file benchmark.h.
impala::Benchmark::Benchmark | ( | const std::string & | name | ) |
Name of the microbenchmark. This is outputted in the result.
Definition at line 64 of file benchmark.cc.
int impala::Benchmark::AddBenchmark | ( | const std::string & | name, |
BenchmarkFunction | fn, | ||
void * | args, | ||
int | baseline_idx = 0 |
||
) |
Add a benchmark with 'name' to the suite. The first benchmark is assumed to be the baseline. Reporting will be done relative to that. Returns a unique index for this benchmark. baseline_idx is the base function to compare this one against. Specify -1 to not have a baseline.
Definition at line 70 of file benchmark.cc.
References benchmarks_, impala::name, and impala::Benchmark::BenchmarkResult::name.
Referenced by main(), impala::InPredicateBenchmark::RunDecimalBenchmark(), impala::InPredicateBenchmark::RunIntBenchmark(), and impala::InPredicateBenchmark::RunStringBenchmark().
|
static |
Output machine/build configuration as a string.
Definition at line 124 of file benchmark.cc.
References impala::CpuInfo::model_name().
Referenced by main().
string impala::Benchmark::Measure | ( | ) |
Runs all the benchmarks and returns the result in a formatted string.
Definition at line 83 of file benchmark.cc.
References benchmarks_, name_, and padding.
Referenced by main(), impala::BenchmarkTest::Measure(), impala::InPredicateBenchmark::RunDecimalBenchmark(), impala::InPredicateBenchmark::RunIntBenchmark(), and impala::InPredicateBenchmark::RunStringBenchmark().
|
staticprivate |
Benchmarks the 'function' returning the result as invocations per ms. args is an opaque argument passed as the second argument to the function. max_time is the total time to benchmark the function, in ms. initial_batch_size is the initial batch size to the run the function. The harness function will automatically ramp up the batch_size. The benchmark will take at least initial_batch_size * function invocation time.
Definition at line 28 of file benchmark.cc.
References impala::CpuInfo::cycles_per_ms(), impala::StopWatch::ElapsedTime(), impala::StopWatch::Start(), and impala::StopWatch::Stop().
|
friend |
Definition at line 56 of file benchmark.h.
|
private |
Definition at line 76 of file benchmark.h.
Referenced by AddBenchmark(), and Measure().
|
private |
Definition at line 75 of file benchmark.h.
Referenced by Measure().