Received: by 10.223.185.116 with SMTP id b49csp594396wrg; Fri, 23 Feb 2018 03:50:55 -0800 (PST) X-Google-Smtp-Source: AH8x2269TkkTPzij3vatApUyr5wP94uDhW4SlJQDMFQSTsy1o1gyAmDeiUqA1tfRWo8W8YjddhTZ X-Received: by 10.99.42.17 with SMTP id q17mr1228990pgq.6.1519386655124; Fri, 23 Feb 2018 03:50:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519386655; cv=none; d=google.com; s=arc-20160816; b=dJKWR74jQ+bT3E+g8ZlnHJV3bUmkyh8eIgeaioQhCqOo0jNDRYS8UpZmCJf8AqdgV8 rVY7maDmLTPPVIsHD3A3fmAGHgmbW8ClX00WbUt9Tw/7Qerv4oBNSllPhAE7cdJd8UGM 53QkDT7esXYhioN7TIZW4GfW1Tt4UEtja70PP9rQJ7oluh0p9FcpLbrBJhKHSqRPgm8o ue+8MRBb0WI8f3mN1LFvJARMT9xNelYtjCNL6gFz93Yu8K7poyJfV4GoRYmYdhVcxspD TtHXSSkjNFoHUy/OVaJlkZt1svKzJQ4burwgOsNNt8EHQpKT2/HJXMbOFiPSySs2tRhv uCmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9MopgO6mMbtDQ35p7vyhq4AB5NLU83qmDBItFZ5FNGE=; b=YaPup29kHBgNQ52FkHhND5rIknFpbN1P7ZrsTbBjR62rR3Cer/btuuj5+B/NpzKnte Fqg7Y5hbfU4eockoVw6W8P9KBASdFm5uXRbbOPzQnSOosVt/gI6WQw3VNMt7diHD6VW4 dVjhmTri3BwTH7H9fDF0JxiGqG5+AUbUR0rUlWzlDTy36p20/8+IyZd1juRrB3z9Nqcw WAXCh1n+jUdfkfIqpP4dK0AiTFs/qgpePl2xuqSDn9515znzjyBgYIDUs8J9HZLPhesz fQ1AgYpftkhMUp6kECUhaPny+GlfWHeYgnUTMySeqKUqWYM9YC71m51qkdcHfwNrQ9sd +U5A== 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 g12-v6si1668327pla.226.2018.02.23.03.50.40; Fri, 23 Feb 2018 03:50:55 -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 S1751357AbeBWLtd (ORCPT + 99 others); Fri, 23 Feb 2018 06:49:33 -0500 Received: from mga12.intel.com ([192.55.52.136]:46911 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750798AbeBWLtc (ORCPT ); Fri, 23 Feb 2018 06:49:32 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2018 03:49:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,383,1515484800"; d="scan'208";a="22496405" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga002.fm.intel.com with ESMTP; 23 Feb 2018 03:49:30 -0800 From: changbin.du@intel.com To: acme@kernel.org, jolsa@redhat.com Cc: peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Changbin Du Subject: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed Date: Fri, 23 Feb 2018 19:40:40 +0800 Message-Id: <1519386040-25874-1-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changbin Du This is to show the real name of thread that created via fork-exec. See below example for shortname *A0*. $ 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