Reputation: 63
We are porting our application from solaris to linux. Few workflows in linux application are taking more time than solaris application. I have used solaris studio profiler to analyze at function level that gives me time consumed by each function. But in linux I explored perf tool, I could not find out How can I attach perf to a running application and did not find out any command which will print the time consumed by each function of a process. Thanks in advance.
Upvotes: 0
Views: 1006
Reputation: 4679
Attaching to a process is done by using the -p
option in perf record
(from man perf-record
):
-p, --pid=
Record events on existing process ID (comma separated list).
So assuming that your process has ID 12345, you can attach to it with (enabling call-graphs with -g
):
perf record -g -p 12345
perf will then automatically write perf.data
when the process terminates. You can then examine the file by calling
perf report
I hope this helps.
Upvotes: 2