Received: by 10.223.185.116 with SMTP id b49csp8979017wrg; Fri, 2 Mar 2018 11:09:17 -0800 (PST) X-Google-Smtp-Source: AG47ELuNzBlVzlJMX2Uk5cyR9mulWk0Cu2OZ9y7nNnEC5814wc+aMQSdhA5hEB250mfGroMngPbK X-Received: by 2002:a17:902:44:: with SMTP id 62-v6mr5967162pla.193.1520017757012; Fri, 02 Mar 2018 11:09:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520017756; cv=none; d=google.com; s=arc-20160816; b=vGBM7pcEE3Mh2zhC5iLhowJkRsP+u8PVqDRruH6Jv888JlFBnVsaRAxqw6sQjKsYP6 nsC9527QBMm+F0ldjCPmELeuS7frf9XnT5jx0FMlfEh1bUVlrNvTGtVRFJlBnUdmojv0 5DWyk3RHP99RdHt7T2O1y0RST4Nc75jQd6mIFS4QsGXgUfiNNtD9b/nCxWdZ4BvzedDg 8BKm9FuWjBQOG5iEf9yQGS96iERu3PPu7U6ynK0dbHZ5lzvUYV7g2zq+A4YLBA/CyXt3 Nmj98LoJSjuNikmbG/5yyKVsCX8BjmvzNl/L0fgUO+C7KWx413TEHnDJE0e1Dzzci2ss FaVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=cwt5ggjn3Ah3lLiGTXXVvcHLe+OW2zDqjqS2bsSnSYw=; b=uc5CB1OmuBOhnwlTvRdwIdtYNQ1fblmBW66xoG4wSIXscI+xZTEUB8uTusozEaizZN BgZSP4ZH8+LnLTrWi5uCHwJHpWHbdJSawACfgO7nGBiuo5WtrLnyuQXu49DV48WjaaIE NyZjTWXKACrG65j2UpJ45Ixv8YkQyaYK8S9/Ci+2Ieml/YF5EbrYkh3+yMcc/s+NlVLt NlmtNwTt5LQ0nWXbdp0H6rqcP8pEpmTxCllbknwxMja1sGxTtLwuy7DYphBQc3JEOT+B gt5Vxa8bCA93LPjbrudBJoxeoMIxr9JcSuA5oIjT3FkEllvuL6y5IJcGTYK59oJZ27P/ 0LFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h89si5348928pfa.182.2018.03.02.11.08.43; Fri, 02 Mar 2018 11:09:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426376AbeCBOnT (ORCPT + 99 others); Fri, 2 Mar 2018 09:43:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:54272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1426299AbeCBOnQ (ORCPT ); Fri, 2 Mar 2018 09:43:16 -0500 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06B40206B2; Fri, 2 Mar 2018 14:43:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06B40206B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Received: by jouet.infradead.org (Postfix, from userid 1000) id B3AAA143CE8; Fri, 2 Mar 2018 11:43:12 -0300 (-03) Date: Fri, 2 Mar 2018 11:43:12 -0300 From: Arnaldo Carvalho de Melo To: changbin.du@intel.com Cc: jolsa@redhat.com, peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed Message-ID: <20180302144312.GC4086@kernel.org> References: <1519386040-25874-1-git-send-email-changbin.du@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519386040-25874-1-git-send-email-changbin.du@intel.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Feb 23, 2018 at 07:40:40PM +0800, changbin.du@intel.com escreveu: > From: Changbin Du > > This is to show the real name of thread that created via fork-exec. > See below example for shortname *A0*. Can you ellaborate a bit more and perhaps provide before and after outputs? - Arnaldo > $ sudo ./perf sched map > *A0 80393.050639 secs A0 => perf:22368 > *. A0 80393.050748 secs . => swapper:0 > . *. 80393.050887 secs > *B0 . . 80393.052735 secs B0 => rcu_sched:8 > *. . . 80393.052743 secs > . *C0 . 80393.056264 secs C0 => kworker/2:1H:287 > . *A0 . 80393.056270 secs > . *D0 . 80393.056769 secs D0 => ksoftirqd/2:22 > . *A0 . 80393.056804 secs A0 => pi:22368 > . *. . 80393.056854 secs > *B0 . . 80393.060727 secs > ... > > Signed-off-by: Changbin Du > --- > tools/perf/builtin-sched.c | 4 +++- > tools/perf/util/thread.c | 1 + > tools/perf/util/thread.h | 1 + > 3 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c > index 83283fe..53bb8df 100644 > --- a/tools/perf/builtin-sched.c > +++ b/tools/perf/builtin-sched.c > @@ -1580,7 +1580,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, > > timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp)); > color_fprintf(stdout, color, " %12s secs ", stimestamp); > - if (new_shortname || (verbose > 0 && sched_in->tid)) { > + if (new_shortname || sched_in->comm_changed || (verbose > 0 && sched_in->tid)) { > const char *pid_color = color; > > if (thread__has_color(sched_in)) > @@ -1588,6 +1588,8 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, > > color_fprintf(stdout, pid_color, "%s => %s:%d", > sched_in->shortname, thread__comm_str(sched_in), sched_in->tid); > + > + sched_in->comm_changed = false; > } > > if (sched->map.comp && new_cpu) > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c > index 68b65b1..c660fe6 100644 > --- a/tools/perf/util/thread.c > +++ b/tools/perf/util/thread.c > @@ -212,6 +212,7 @@ static int ____thread__set_comm(struct thread *thread, const char *str, > unwind__flush_access(thread); > } > > + thread->comm_changed = true; > thread->comm_set = true; > > return 0; > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h > index 40cfa36..b9a328b 100644 > --- a/tools/perf/util/thread.h > +++ b/tools/perf/util/thread.h > @@ -27,6 +27,7 @@ struct thread { > int cpu; > refcount_t refcnt; > char shortname[3]; > + bool comm_changed; > bool comm_set; > int comm_len; > bool dead; /* if set thread has exited */ > -- > 2.7.4