use valgrind to know time(in seconds) spent in each function

前端 未结 3 850
南旧
南旧 2021-01-31 03:01

is there any extension of valgrind, that can be used in the command window, that would help me know the time, in seconds, spent in each function in my C code?

thanks =)<

3条回答
  •  梦如初夏
    2021-01-31 03:18

    For machine instruction profiling use valgrind's callgrind (also, cachegrind can do cache and branch prediction profiling which is quite nice).

    For time measurements use google's cpu profiler, it gives way better results than gprof. You can set sampling frequency and it can show the output as a nice annotated call graph.

提交回复
热议问题