From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754254AbbDGQlT (ORCPT ); Tue, 7 Apr 2015 12:41:19 -0400 Received: from mail.kernel.org ([198.145.29.136]:50840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754215AbbDGQlP (ORCPT ); Tue, 7 Apr 2015 12:41:15 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , Borislav Petkov , David Ahern , Don Zickus , Frederic Weisbecker , Jiri Olsa , Namhyung Kim , Stephane Eranian Subject: [PATCH 01/16] perf top: Consider PERF_RECORD_ events with cpumode == 0 Date: Tue, 7 Apr 2015 13:40:47 -0300 Message-Id: <1428424862-30032-2-git-send-email-acme@kernel.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1428424862-30032-1-git-send-email-acme@kernel.org> References: <1428424862-30032-1-git-send-email-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo Some events (PERF_RECORD_COMM,EXEC,EXIT,etc) don't set perf_event_attr.misc with the PERF_RECORD_MISC_ bits in PERF_RECORD_MISC_CPUMODE_MASK, and were being discarded, for those we need just to set the machine to be used to be machines.host. Even with those events not being considered 'top' worked because it would create thread structs by means of machine__findnew_thread() when processing a sample or PERF_RECORD_MMAP event, that sets the field to PERF_RECORD_MISC_USER, and thus we could find the DSO where samples took place, resolve IPs to symbols, etc. But the effect was that the threads would remain in machines->threads forever, slowly using more and more memory and making the thread lookup to take longer than needed, fix it. Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-pzzsmdr4ljsso771ul83ij1f@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-top.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 1cb3436276d1..67349fdc51d8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -832,6 +832,12 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) ++top->kernel_samples; if (top->hide_kernel_symbols) goto next_event; + /* Fall thru */ + default: + /* + * For events that don't set the cpumode, like: + * PERF_RECORD_{COMM,FORK,EXIT,THROTTLE,UNTHROTTLE} + */ machine = &session->machines.host; break; case PERF_RECORD_MISC_GUEST_KERNEL: @@ -845,8 +851,6 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) * TODO: we don't process guest user from host side * except simple counting. */ - /* Fall thru */ - default: goto next_event; } -- 1.9.3