DigitalInBlue / Celero

C++ Benchmark Authoring Library/Framework
Other
822 stars 96 forks source link

Allow other measurements to be taken #126

Closed tinloaf closed 5 years ago

tinloaf commented 5 years ago

Feature Request:

It would be great if it was possible to add user-defined measurements to the experiments. For example, I would like to measure via PAPI the number of cache misses and branch mispredictions in my code. One could even go further and measure the number of CPU cycles (and forget about the timing completely) via PAPI.

I'm currently thinking about cooking up a PR. Before I start coding, I wanted to make sure that this has a chance of being accepted. Also, it might be worthwhile to discuss the design: I would probably add a method in TestFixture that allows reporting user-defined measurements. Whatever compiles the output and does the statistics would then need to collect user-defined measurements from all TestFixture instances that are created.

DigitalInBlue commented 5 years ago

I think this is a good idea. If it were done in a generic way, I would have no problem accepting it. You would have to collect measurements, decide how to compile the data that is collected, and decide how to output that data. (This could all be done with lambdas, or std::function objects, I imagine.) This would be a great feature.

If you do this, I would also want to see an example usage added to the code base, even if it is something trivial. Let me know if you have any questions that I can help with.