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