Re: [RFC][PATCH 0/4] tracing: Add event-fork to trace tasks children

From: Daniel Bristot de Oliveira
Date: Tue Apr 19 2016 - 22:05:38 EST



On 04/19/2016 11:34 AM, Steven Rostedt wrote:
> This code adds the event-fork option that, when set, will have tasks
> with their PIDs in set_event_pid add their children PIDs when they
> fork. It will also remove their PID from the file on exit.

That is a nice feature! I tested it and it works. But, look this...

Set the event-fork, the current shell pid, and enable the trace:

[root@f23 tracing]# echo event-fork > trace_options
[root@f23 tracing]# echo $$ > set_ftrace_pid
[root@f23 tracing]# echo function > current_tracer

to exercise the feature, start the httpd...

[root@f23 tracing]# httpd

[root@f23 tracing]# cat trace | awk '{print $1}' | sort | uniq
awk-2209
bash-2162
bash-2208
httpd-2196
httpd-2197
httpd-2199
httpd-2200
httpd-2201
httpd-2202
httpd-2203
httpd-2204
httpd-2205
httpd-2206
httpd-2207
sort-2210
uniq-2211

Awesome :-) it works!

But, the set_ftrace_pid only shows the pid of the shell. I thought
it would print all child's pid.

[root@f23 tracing]# cat set_ftrace_pid
2162

Now, lets finish the session:

[root@f23 tracing]# echo 0 > tracing_on
[root@f23 tracing]# echo nop > current_tracer
[root@f23 tracing]# echo > trace
[root@f23 tracing]# echo > set_ftrace_pid
[root@f23 tracing]# echo noevent-fork > trace_options

and start a simple trace again, filtering the watchdog/0 thread:

[root@f23 tracing]# echo 14 > set_ftrace_pid
[root@f23 tracing]# echo function > current_tracer
[root@f23 tracing]# echo 1 > tracing_on

(this is a trick to make httpd work)
[root@f23 tracing]# kill -1 2197

voilÃ!

[root@f23 tracing]# cat trace | awk '{print $1}' | sort | uniq
httpd-2197
httpd-2501
httpd-2503
httpd-2506
httpd-2507
httpd-2526
httpd-2527
httpd-2528
httpd-2529
httpd-2530
httpd-2531
httpd-2532
httpd-2533
httpd-2534
httpd-2535
watchdog/0-14

The httpd stills being filtered, and I did not find a way to remove
them. Although I see that they will be removed when they exit, I
think it would be nice to remove them when cleaning
set_ftrace_pid.

Am I missing something?

-- Daniel