From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754226AbcDTCFf (ORCPT ); Tue, 19 Apr 2016 22:05:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41461 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751936AbcDTCFd (ORCPT ); Tue, 19 Apr 2016 22:05:33 -0400 Subject: Re: [RFC][PATCH 0/4] tracing: Add event-fork to trace tasks children To: Steven Rostedt , linux-kernel@vger.kernel.org References: <20160419143421.829909157@goodmis.org> Cc: Ingo Molnar , Andrew Morton , "H. Peter Anvin" , Thomas Gleixner , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , linux-trace-users@vger.kernel.org From: Daniel Bristot de Oliveira Message-ID: <5716E3E8.7000609@redhat.com> Date: Tue, 19 Apr 2016 23:05:28 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160419143421.829909157@goodmis.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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