Bug 203821 - Cannot get all the executed kernel functions with trace-cmd when running one script
Summary: Cannot get all the executed kernel functions with trace-cmd when running one ...
Status: RESOLVED INVALID
Alias: None
Product: Tools
Classification: Unclassified
Component: Trace-cmd/Kernelshark (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Default virtual assignee for Trace-cmd and kernelshark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-05 16:54 UTC by Dongliang Mu
Modified: 2019-06-07 06:52 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.13.0-rc2
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Dongliang Mu 2019-06-05 16:54:44 UTC
I trace the execution of test_script and its child processes:

trace-cmd record -p function -e function -c ./test_script

In the above command, no "-l" option is used to filter functions. So will it trace all the functions invoked during the runtime?

Unfortunately, I did not find the function A(executed certainly and not inline function) in the result of `trace-cmd report`.
But when I use "-l A", that is,

trace-cmd record -p function -e function -l A -c ./test_script

Then I can find A in the result of `trace-cmd report`.

Please let me know if you have any issues.
Comment 1 Steven Rostedt 2019-06-05 17:03:56 UTC
I'm currently traveling and may be slow to respond. I'll be back at my normal
hours on Monday, June 10th.

-- Steve
Comment 2 Steven Rostedt 2019-06-06 06:40:09 UTC
Hi Dongliang,

Note, you do not need the "-e function". Just add "-p function" and all functions will be traced. You may find a "/sys/kernel/tracing/events/ftrace/function" but that's just for tools to know how to parse the function entry that is created by the "-p function".

As for not seeing the function you want, it may be that it was lost in the noise. The function tracer is the most stressful tracing and usually fills up the ring buffer before the reader can capture and save all the functions. Thus you will see dropped events. That is shown during a trace-cmd record after tracing is finished:

 # trace-cmd record -p function cat /etc/passwd
CPU 1: 580 events lost
CPU 3: 1450 events lost
CPU 4: 2175 events lost
CPU 6: 13630 events lost
CPU 7: 1160 events lost

If the function you are looking for happens to be in one of those lost events, it will not be shown.

-- Steve

Note You need to log in before you can comment on or make changes to this bug.