sharkdp/hyperfine

Allow custom time measurements

mktip opened this issue · 1 comments

I have a usecase in which I want to measure two implementatitons of an application. The application measures the time of the section I care about and prints it to stdout like so:

$ ./my_app -v 1 -i input.txt
Execution time: 2.504 s
$ ./my_app -v 2 -i input.txt
Execution time: 1.203 s

But actually if you measure the overall execution time, they would look similar if not the opposite of the section I care about

$ time ./my_app -v 1 -i input.txt
Execution time: 2.504 s

real: 54 s
$ time ./my_app -v 2 -i input.txt
Execution time: 1.203 s

real: 61 s

Thus, even hyperfine would be measuring the full exection whereas I might only care about the specific time measurements made by the app. I was wondering if there is a way to inform hyperfine of how to get the time information from runs. For example if hyperfine had an option like -parse-time 'grep "Execution time" | sed -e "s/^Execution time: //" -e "s/\ss$//"' -unit seconds that would allow for custom ways of informing hyperfine of how to get its run-time info

Is there something already like this? if not is this a reasonable feature to add?