mirror of
https://github.com/google/benchmark.git
synced 2024-12-28 21:40:15 +08:00
Merge branch 'mac' of git://github.com/eddyxu/benchmark into eddyxu-mac
This commit is contained in:
commit
b30603094a
@ -9,6 +9,7 @@ set_directory_properties(properties EP_PREFIX "${CMAKE_BINARY_DIR}/third_party")
|
||||
ExternalProject_Add(googletest
|
||||
URL "https://googletest.googlecode.com/files/gtest-1.7.0.zip"
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/third_party/gtest"
|
||||
CMAKE_ARGS "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
||||
INSTALL_COMMAND "")
|
||||
ExternalProject_Get_Property(googletest source_dir)
|
||||
include_directories(${source_dir}/include)
|
||||
|
@ -390,19 +390,20 @@ void BenchmarkFamilies::FindBenchmarks(
|
||||
if (family->rangeX_.empty() && family->rangeY_.empty()) {
|
||||
instances = family->CreateBenchmarkInstances(
|
||||
Benchmark::kNoRange, Benchmark::kNoRange);
|
||||
benchmarks->insert(benchmarks->end(), instances.begin(), instances.end());
|
||||
std::copy(instances.begin(), instances.end(),
|
||||
std::back_inserter(*benchmarks));
|
||||
} else if (family->rangeY_.empty()) {
|
||||
for (size_t x = 0; x < family->rangeX_.size(); ++x) {
|
||||
instances = family->CreateBenchmarkInstances(x, Benchmark::kNoRange);
|
||||
benchmarks->insert(benchmarks->end(), instances.begin(),
|
||||
instances.end());
|
||||
std::copy(instances.begin(), instances.end(),
|
||||
std::back_inserter(*benchmarks));
|
||||
}
|
||||
} else {
|
||||
for (size_t x = 0; x < family->rangeX_.size(); ++x) {
|
||||
for (size_t y = 0; y < family->rangeY_.size(); ++y) {
|
||||
instances = family->CreateBenchmarkInstances(x, y);
|
||||
benchmarks->insert(benchmarks->end(), instances.begin(),
|
||||
instances.end());
|
||||
std::copy(instances.begin(), instances.end(),
|
||||
std::back_inserter(*benchmarks));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,13 +36,14 @@
|
||||
|
||||
namespace benchmark {
|
||||
namespace {
|
||||
const int64_t estimate_time_ms = 1000;
|
||||
pthread_once_t cpuinfo_init = PTHREAD_ONCE_INIT;
|
||||
double cpuinfo_cycles_per_second = 1.0;
|
||||
int cpuinfo_num_cpus = 1; // Conservative guess
|
||||
pthread_mutex_t cputimens_mutex;
|
||||
|
||||
#if !defined OS_MACOSX
|
||||
const int64_t estimate_time_ms = 1000;
|
||||
|
||||
// Helper function estimates cycles/sec by observing cycles elapsed during
|
||||
// sleep(). Using small sleep time decreases accuracy significantly.
|
||||
int64_t EstimateCyclesPerSecond() {
|
||||
|
Loading…
Reference in New Issue
Block a user