Received: by 10.223.185.116 with SMTP id b49csp2293382wrg; Sun, 4 Mar 2018 23:40:16 -0800 (PST) X-Google-Smtp-Source: AG47ELue28AJ4UtQnJ27+XuAlSDcAGdtM2V08euo0AZZt/qhYZ5Rp3aqDzfPnH/zEYqJ7WUM6Xe8 X-Received: by 10.99.96.200 with SMTP id u191mr11548952pgb.252.1520235616261; Sun, 04 Mar 2018 23:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520235616; cv=none; d=google.com; s=arc-20160816; b=LDpNP6ZtMAYy95+RlK2zpoO8FIsu+GCF2CT5HpM/wLw42IRMG+ejLcIxVcwxWjIx1+ 61cC0EqIRu6Q5Jp/xlw8r9nkq6VhUuFn6WU+BEzswSxd3N067H8JCGIJprvSgSbppbyb kHhMBea2DQMJjD0u6clZ9qnPpjhRaJXsgC4Chrg6d7gQOQbnQruOQ13gZ5zDMqeo1fVO 12a6YemXMzxNAyPrIjiHQOSQltLhEGRJCljia9L8K5Ubrie4Bbxs/pStQ0+a2iE5jutx W23VCuRMYBuwWQqWfGcJONm56t7zBzb/M8GP7djNxDqgj5tRmlOm5zA5KACFlufaokWj 1YPw== 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:arc-authentication-results; bh=1GO6kpqdpvGhroDnDZ38hJZqi4ys7sj5yB0jjTyPThU=; b=RIz9Kle1thTyUJsj9/QAkDRlGYWKaeZwHQW7Zy3Nw+zSZEz+jQhsUnLJTW0+ZkE3VS XE2P6QiMdtLf6LMHn/POR4EtkTuJB/udwnhdxVFDXCkbdXBYzvrzyWPQVCUy3j2SGc1W IH+GqH2mkAKmIqFnU9GDzxxJKTRudib9IQbekCrXZC+K9GKEWTrfnIlv2A13caipiNwk h0bt8PErOahhnLdtNecOihGmnvDNcT5fBxMxHQRIqkYRa/EMYG619SzEIdDIIXy949iu 4mjznuxMEoBQRsnL7XZK3zy487RqtRqHLhZ7MWfOABZwLPf1Jsn13iqrMCeI7p1epUSa iEZw== 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 m68si9788211pfb.305.2018.03.04.23.40.02; Sun, 04 Mar 2018 23:40: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 S933138AbeCEHXO (ORCPT + 99 others); Mon, 5 Mar 2018 02:23:14 -0500 Received: from mga17.intel.com ([192.55.52.151]:15836 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932679AbeCEHXN (ORCPT ); Mon, 5 Mar 2018 02:23:13 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2018 23:23:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,426,1515484800"; d="scan'208";a="22951446" Received: from gvt-dell.bj.intel.com (HELO intel.com) ([10.238.154.59]) by orsmga006.jf.intel.com with SMTP; 04 Mar 2018 23:23:10 -0800 Date: Mon, 5 Mar 2018 15:14:12 +0800 From: "Du, Changbin" To: Arnaldo Carvalho de Melo Cc: changbin.du@intel.com, 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: <20180305071412.kem6yrxsg6nkskms@intel.com> References: <1519386040-25874-1-git-send-email-changbin.du@intel.com> <20180302144312.GC4086@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180302144312.GC4086@kernel.org> User-Agent: NeoMutt/20171027-42-ad8712 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 02, 2018 at 11:43:12AM -0300, Arnaldo Carvalho de Melo wrote: > 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 > Arnaldo, please see below diff stat. *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 . 80393.056804 secs A0 => pi:22368 . *. . 80393.056854 secs > > $ 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 -- Thanks, Changbin Du