simplest tool to measure C program cache hit/miss and cpu time in linux?

后端 未结 4 1447
渐次进展
渐次进展 2020-11-29 16:09

I\'m writing a small program in C, and I want to measure it\'s performance.

I want to see how much time do it run in the processor and how many cache hit+misses has

4条回答
  •  半阙折子戏
    2020-11-29 17:13

    The best tool for you is called valgrind. It is capable of memory profiling, call-graph building and much more.

    sudo apt get install valgrind
    valgrind ./yourapp
    

    However, to obtain the time your program executed, you can use time(8) linux utility.

    time ./yourapp
    

提交回复
热议问题