benchmark
benchmark copied to clipboard
[FR] support any platform through user-provided functions
Is your feature request related to a problem? Please describe.
I'd like to use the benchmark suite in a restricted environment which differs from the currently supported platforms, like linux or windows. There might not be a steady clock provided through the libstdc++
, nor are pthreads
available but a compatibility layer and ultimately my platform exposes its own functions to measure CPU usage for example.
Describe the solution you'd like I've seen there are already platform-specific switches in-place in some functions. I'd like to be able to provide my own implementations or fallbacks for some parts of the suite.
I could think of the following categories, where that would be useful, also including any errors I got:
-
output streams/console: The user could provide their own
std::cout
, console color detection, etc. - thread library: Since this is detected by CMake, there's not much you could to at compile-time.
-
timing functions: Provide your own
ProcessCPUUsage
,ThreadCPUUsage
, etc. - cycle clock
-
system info: Like
GetSystemName
Describe alternatives you've considered I couldn't really think of any, yet. Maybe I need to write a linux compatible layer, so that the suite would use the linux API, which internally translate all calls according to my platform, but that is quite the undergoing.
Additional context I acknowledge that my request is an bedge-case. However, I think, that by making it possible to provide user-defined fallbacks for all sorts of functionality of the suite, makes it more attractive for other platform and improves its compatibility.