Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757197AbYLOWJU (ORCPT ); Mon, 15 Dec 2008 17:09:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756253AbYLOWJJ (ORCPT ); Mon, 15 Dec 2008 17:09:09 -0500 Received: from mail-bw0-f21.google.com ([209.85.218.21]:54354 "EHLO mail-bw0-f21.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756108AbYLOWJI (ORCPT ); Mon, 15 Dec 2008 17:09:08 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=EtyHbNK8xnfw+saeFS2+tgyEUM3l8fBVtXqxYKQ/9VrZczxaw0MJ4e5gqGAFcMJhXZ Aem3vj4rS4eCCFbMqsfi+U1ftAveVN+hqpyPMwLYOrdrr6j2yulWrVuS5fWVMTMHi3QN /y8X6Tt4orgK81ljTwfpbTlBgZTWhmXLXWjyc= Message-ID: <7c86c4470812151403s5c8c1fe3u4c7c9e7f67e0055b@mail.gmail.com> Date: Mon, 15 Dec 2008 23:03:45 +0100 From: "stephane eranian" Reply-To: eranian@gmail.com To: "Paul Mackerras" Subject: Re: [patch] Performance Counters for Linux, v4 Cc: "Vince Weaver" , "Ingo Molnar" , linux-kernel@vger.kernel.org, "Thomas Gleixner" , "Andrew Morton" , "Eric Dumazet" , "Robert Richter" , "Arjan van de Ven" , "Peter Anvin" , "Peter Zijlstra" , "David S. Miller" , perfctr-devel@lists.sourceforge.net In-Reply-To: <18758.53072.197695.277198@cargo.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081214212829.GA9435@elte.hu> <18758.53072.197695.277198@cargo.ozlabs.ibm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1665 Lines: 34 On Mon, Dec 15, 2008 at 10:42 PM, Paul Mackerras wrote: > Vince Weaver writes: > >> I see a large (2300 instruction) fixed overhead when measuring >> retired instruction count using the "timec" command >> compared to the "pfmon" tool that comes with perfmon3 >> (the pfmon tool has essentially no overhead when >> doing aggragate counts). > > Looks like timec will be counting the fork() and execvp() system calls > that are used to run your executable, as well as the executable > itself. The fork() overhead could be removed fairly easily I think, > the execvp would be hard to get rid of without using ptrace() - and > the use of ptrace was one of the things that Ingo et al. objected to > in perfmon3. > Paul, I think your analysis is correct. This is likely what is happening. Not that timec could not use ptrace() to block the task from executing its first instruction, but you'd still have a problem because of prctl(ENABLE) which applies to the current task, not another task, unless I am mistaken. Prctl() looks odd to me because you have all those supposedly independent file descriptors to identify events you want to measure, but they are not used to start/stop. If you are attaching to multiple tasks at the same time which you can do with the current API, you may not necessarily want to start/stop all counters at the same time. Looks like prctl() is not what we want after all... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/