Is there a way to benchmark/profile portably?

Simen Kjærås simen.kjaras at gmail.com
Thu May 7 10:51:27 UTC 2020


On Thursday, 7 May 2020 at 10:21:07 UTC, Dukc wrote:
> Is there some way to measure the performance of a function so 
> that the results will be same in different computers (all x86, 
> but otherwise different processors)? I'm thinking of making a 
> test suite that could find performance regressions 
> automatically.
>
> I figured out Bochs[1] could be used for that, but it seems an 
> overkill for me to install a whole virtual operating system 
> just to benchmark functions. Does anybody know more lightweight 
> way?
>
> [1] http://bochs.sourceforge.net/

If I understand correctly, you want to measure how many cycles 
pass, rather than clock time?

If so, it seems perf can do that: 
https://perf.wiki.kernel.org/index.php/Tutorial

--
   Simen


More information about the Digitalmars-d-learn mailing list