Questions tagged [google-benchmark]

84 questions
1
vote
1 answer

_mm256_load_ps cause segmentation fault with google/benchmark in debug mode

The following code can run in both release and debug mode. #include constexpr int n_batch = 10240; constexpr int n = n_batch * 8; #pragma pack(32) float a[n]; float b[n]; float c[n]; #pragma pack() int main() { for(int i = 0; i…
chaosink
  • 1,329
  • 13
  • 27
1
vote
0 answers

Google benchmark returning more time of int divison from double

I am new to google benchmark tool, I am testing all the operation timings.Please find my code as below.In this code i am testing how much time each operation (add / sub /mul /div) will take on my hardware. #include double…
Mohit
  • 337
  • 2
  • 13
1
vote
1 answer

GBenchmark and CMake

From relevant search on the web, I got an impression that google-benchmark is not easily incorporated into a CMake-project. One way I could do that is adding as external project, replicating verbatim the corresponding text for GTest in google-test's…
Ilonpilaaja
  • 1,169
  • 2
  • 15
  • 26
1
vote
1 answer

googlebenchmark and MPI: Is there hope?

I want to run a particular MPI function under google benchmark. Something like: #include #include template void MPIInitFinalize(benchmark::State& state) { auto mpi = []() { MPI_Init(nullptr,…
user14717
  • 4,757
  • 2
  • 44
  • 68
1
vote
1 answer

N functions x M datasets with google benchmark

Imagine that I would like to test serialization/deserializtion routines against three different datasets. This results in 2x3=6 benchmarks. Ideally, I would like to achieve the following: avoid code duplication call dataset generator functions only…
gudok
  • 4,029
  • 2
  • 20
  • 30
1
vote
1 answer

How to use a templated google benchmark fixture with custom arguments correctly?

I want to modify a templated google benchmark (with custom arguments) to run with a test fixture class, but don't know if this is really possible and if so, how the correct syntax is. Just adding the fixture class doesn't seem to be enough. static…
1
vote
0 answers

Configure cmake to use google test in a parallel directory to google benchmark

I have a project where I have googletest in a sub-directory called Tests/GTest and I want to put google benchmark in a parallel sub-directory called Tests/GBenchmark (and probably google mock in Tests/GMock). That seems to be the corporate coding…
intel_chris
  • 708
  • 1
  • 6
  • 17
1
vote
1 answer

Benchmark undefined reference to `std::thread::_M_start_thread CMake

I want to use Google Benchmark, for that I have a simple test written in main.cpp file. to build my project I have a CMake file as follow: cmake_minimum_required(VERSION…
Rabia Syed
  • 15
  • 8
1
vote
2 answers

Google/benchmark inconsistent results

I'm new to using Google Benchmark and receive different results running the same benchmark (below), which retrieves the local time using C++, when running the code locally vs on Quick-Bench.com. Both times I used GCC 8.2 and -O3. Why do the results…
Orangeberry
  • 41
  • 1
  • 7
1
vote
0 answers

LockFreeStack benchmark (oversubscription state)

I've implemented lock-free Stack, based on 'Concurrency in action' book example. I wanted to benchmark it and compare it to other lock-free stacks, i.e from boost::lockfree. I used google benchmark framework to conduct those tests, measuring single…
1
vote
1 answer

Google benchmark code Setup

Given the following code #include #include static void BM_foo(benchmark::State& state) { std::cout << "Foo "<< std::endl; for (auto _: state) { std::cout << state.iterations() << " In loop "…
zhihuifan
  • 1,093
  • 2
  • 16
  • 30
1
vote
1 answer

google benchmark: Assertion `has_range_x_' failed

In a project i start to use google/benchmark from https://github.com/google/benchmark.git tag v1.0.0. I run the very simple test #include #include static void BM_memcpy(benchmark::State& state) { char* src = new…
schorsch_76
  • 794
  • 5
  • 19
0
votes
0 answers

How can I provide big input to benchmark functions?

Google benchmark has two ways of registering benchmarks and two ways of providing input to them. One can register benchmarks with BENCHMARK or with benchmark::RegisterBenchmark (more info here). If I want to give a benchmark function one number at a…
user13840624
  • 133
  • 8
0
votes
0 answers

How to pass input files to Google benchmark?

The benchmarked code requires some input. I have gathered the data in several files. I would like to run the benchmark like this: ./benchmark file1.txt file2.txt file3.txt The files should be then used as input to the benchmarked code. In my…
user13840624
  • 133
  • 8
0
votes
0 answers

Multithreading performance test with Google Benchmark

I am looking out for sample for testing multithread test using google benchmark library. In my case i have two functions - Reader() and writer() which are using common data structures protected by lock. i have seen examples where one can run single…
Ams S
  • 1