From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: How to trace threads created by a process after perf has started recording, using the -p PID flag? Date: Tue, 04 Sep 2012 10:04:31 -0600 Message-ID: <5046268F.4050504@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pb0-f46.google.com ([209.85.160.46]:49285 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757312Ab2IDQEe (ORCPT ); Tue, 4 Sep 2012 12:04:34 -0400 Received: by pbbrr13 with SMTP id rr13so9703443pbb.19 for ; Tue, 04 Sep 2012 09:04:34 -0700 (PDT) In-Reply-To: Sender: linux-perf-users-owner@vger.kernel.org List-ID: To: Mikolaj Konarski Cc: chenggang.qin@gmail.com, Bernie Pope , Duncan Coutts , linux-perf-users@vger.kernel.org On 9/3/12 4:17 PM, Mikolaj Konarski wrote: >>> Could someone clarify the behaviour of the -p PID flag of perf-record? >>> In our experiments (3.2.0-27 #43-Ubuntu SMP x86_64), >>> it ignores events on threads spawned after perf-record is started. >>> Is this the intended behaviour, and is there any work-around? > > Anybody? We'd love to use a proven, standard workaround > for this issue, preferably without forcing our users to upgrade > the kernel or wait for any future release. Do we even diagnose > the problem correctly? The best workaround we can come up with > right now is to use the "--filter 'pid==NNNN'" option, but it has > a couple of downsides. Any help would be sincerely appreciated. I see the problem now. The perf tool gets FORK events as threads are created, but it does not respond to them and create new counters. Some refactoring is needed to make that happen. David