From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751565AbZHHQN5 (ORCPT ); Sat, 8 Aug 2009 12:13:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751218AbZHHQN4 (ORCPT ); Sat, 8 Aug 2009 12:13:56 -0400 Received: from mx2.mail.elte.hu ([157.181.151.9]:42833 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbZHHQNz (ORCPT ); Sat, 8 Aug 2009 12:13:55 -0400 Date: Sat, 8 Aug 2009 18:13:42 +0200 From: Ingo Molnar To: Brice Goglin Cc: =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Mike Galbraith , Arnaldo Carvalho de Melo , Peter Zijlstra , paulus@samba.org, LKML Subject: Re: [PATCH] perf report: Display per-thread event counters Message-ID: <20090808161342.GP28892@elte.hu> References: <1249580428.4975.14.camel@laptop> <4A7B175B.8030000@inria.fr> <1249585061.4975.17.camel@laptop> <4A7B28EA.20903@inria.fr> <20090806195924.GA22411@elte.hu> <4A7B68C3.7040706@inria.fr> <20090807063226.GA29532@elte.hu> <4A7C162C.1030707@inria.fr> <20090808121456.GA14671@elte.hu> <4A7DA37A.9010202@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A7DA37A.9010202@inria.fr> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.5 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Brice Goglin wrote: > Ingo Molnar wrote: > >> [...] But I don't see yet where I am suppose to get something like > >> PERF_READ_EVENT in builtin-stat.c so I haven't touched it yet. > >> > > > > Yeah. 'perf stat' is not really getting events but is doing a > > read-out of the counter value(s) and constructs its 'read event' > > that way. So you wont find PERF_READ_EVENT in builtin-stat.c, you'll > > find: > > > > res = read(fd[cpu][counter], single_count, nv * sizeof(u64)); > > > > in read_counter(). The printout is then done in print_counter(). > > Is there a way to get per-thread counters there? I wrote the code > to gather per-cpu counters there, but I don't see any way to get > the corresponding thread-id. > > I looked at perf record to get some help. But I don't see where > the PERF_EVENT_READ are generated. I guess they are directly > generated by the kernel, read by perf record, and written as is to > the output file? Inherited counters are not accessible to the parent context. (they dont even have any fds instantiated, for performance and transparency reasons.) I think perf stat could be enhanced to work not via reading the raw counters but by doing a mini "perf-record" internally, mmap the samples buffer and getting all the events there? Ingo