Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 =)

like image 683
Syntax_Error Avatar asked Jul 12 '11 11:07

Syntax_Error


1 Answers

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.

like image 167
Karoly Horvath Avatar answered Sep 23 '22 00:09

Karoly Horvath