Comments (5)
can you share what you've tried?
from benchmark.
benchmarks using fixtures expect to be registered using BENCHMARK_REGISTER_F
.
you could probably go through the macros and figure out what the callable ends up being. ie, BENCHMARK_REGISTER_F
calls RegisterBenchmarkInternal(new FixtureClass_MethodName_Method())
essentially, so something like RegisterBenchmark("my_bm", FixtureClass_MethodName_Method, args)
might get you close... but it's probably easier to stick with the macro registration.
from benchmark.
I wish I could do it using the macro, but I need to take in arguments from the user and configure the Args of the benchmark with those inputs programmatically. I tried your approach, but I am not sure I am doing it correctly, can you please give a full code example, if it is not too much trouble.
Thank you very much for response.
from benchmark.
Of course, sorry for not posting it at first.
BENCHMARK_DEFINE_F(FixtureClassName, BM_Func)
(::benchmark::State& state) {
for (auto _ : state) {
[..... bench logic here .....]
}
}
int main(int argc, char** argv){
// Some arg parsing logic here (verified to work just fine)
benchmark::Initialize(&rem_argv_len, rem_argv_c.data());
benchmark::RegisterBenchmark("SomeArbitraryName", FixtureClassName_BM_Func_Benchmark)->Arg(0); // checked what the macro resolved to and it puts "_Benchmark" at the end and passing here dummy 0 in Arg but it represents what I would like to do
benchmark::RunSpecifiedBenchmarks();
benchmark::Shutdown();
}
This does not compile.
Thank you greatly for responding :)
from benchmark.
working on this as i get bits of time. i'll post progress here as maybe you can figure it out before i do.
the preprocessor output includes
class FixtureClass : public benchmark::Fixture {
public:
void SetUp(const ::benchmark::State& state) override {}
void TearDown(const ::benchmark::State& state) override {}
};
class FixtureClass_BM_Func_Benchmark : public FixtureClass {
public:
FixtureClass_BM_Func_Benchmark() { this->SetName("FixtureClass" "/" "BM_Func"); }
protected:
void BenchmarkCase(::benchmark::State&) override; };
void FixtureClass_BM_Func_Benchmark::BenchmarkCase(::benchmark::State& state) {
int i = 0;
for (auto _ : state) {
benchmark::DoNotOptimize(i += 1);
}
}
static ::benchmark::internal::Benchmark* benchmark_uniq_2FixtureClass_BM_Func_Benchmark __attribute__((unused)) =
(::benchmark::internal::RegisterBenchmarkInternal(new FixtureClass_BM_Func_Benchmark()))->Arg(0);
from benchmark.
Related Issues (20)
- Complexity calculation does not work for manual timing
- [FR] Reuse benchmark functions with arbitrary fixture templates
- [FR] BENCHMARK_VERSION is not set by default HOT 4
- [BUG] Iteration count in Report looks suspicious HOT 5
- [Q] Need help with understanding the results HOT 1
- [BUG] benchmark::DoNotOptimize does not prevent a reference from being optimized away. HOT 4
- [FR]disable threads for wasm? HOT 9
- [FR] Remove COMPILER_IBMXL macro for z/OS HOT 4
- [BUG] Fixture test with StrictMock crashed HOT 2
- [BUG] HOT 2
- [FR] possible to stop benchmark loop from doing a memory allocation at the end? HOT 1
- [FR] Please release benchmark 1.8.4 HOT 5
- `Wconversion` compile warnings since `1.8.4` HOT 2
- Update nanobind to v2.0 HOT 2
- [REGRESSION] Cmake script in 1.8.4 says that its version is 0.0.0, libbenchmark_main.so.1 became libbenchmark_main.so.0 HOT 4
- [FR] Aggregate multiple benchmark output files HOT 3
- Failed to build HOT 10
- How to post my issue to https://groups.google.com/d/forum/benchmark-discuss HOT 6
- [BUG] In 1.8.4 the suffix of lib/libbenchmark.so.1 went backwards: lib/libbenchmark.so.0 HOT 1
- [BUG] error: too many arguments provided to function-like macro invocation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from benchmark.