All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Kan Liang <kan.liang@intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Andi Kleen <ak@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 10/15] perf tools: Add processor socket info to hist_entry and addr_location
Date: Fri,  4 Sep 2015 22:06:38 -0300	[thread overview]
Message-ID: <1441415203-7484-11-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1441415203-7484-1-git-send-email-acme@kernel.org>

From: Kan Liang <kan.liang@intel.com>

Add processor socket id info in hist_entry and addr_location.

Finor 'perf report', the socket id info is from perf.data.

For others, the socket id info is from current system.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1441377946-44429-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 4 ++++
 tools/perf/util/event.c     | 1 +
 tools/perf/util/hist.c      | 1 +
 tools/perf/util/sort.h      | 1 +
 tools/perf/util/symbol.h    | 1 +
 5 files changed, 8 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 62b285e32aa5..affd70d064bc 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -149,6 +149,7 @@ static int process_sample_event(struct perf_tool *tool,
 		.add_entry_cb 		= hist_iter__report_callback,
 	};
 	int ret = 0;
+	struct perf_env *env = evsel->evlist->env;
 
 	if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) {
 		pr_debug("problem processing %d event, skipping it.\n",
@@ -156,6 +157,9 @@ static int process_sample_event(struct perf_tool *tool,
 		return -1;
 	}
 
+	/* read socket id from perf.data for perf report */
+	al.socket = env->cpu[al.cpu].socket_id;
+
 	if (rep->hide_unresolved && al.sym == NULL)
 		goto out_put;
 
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 7ff61274ed57..0bf8c9889fc0 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1021,6 +1021,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
 
 	al->sym = NULL;
 	al->cpu = sample->cpu;
+	al->socket = cpu_map__get_socket_id(al->cpu);
 
 	if (al->map) {
 		struct dso *dso = al->map->dso;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 08b6cd945f1e..80c4683b3192 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -452,6 +452,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 			.map	= al->map,
 			.sym	= al->sym,
 		},
+		.socket	 = al->socket,
 		.cpu	 = al->cpu,
 		.cpumode = al->cpumode,
 		.ip	 = al->addr,
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 3c2a399f8f5b..7cf1cf7d2406 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -90,6 +90,7 @@ struct hist_entry {
 	struct comm		*comm;
 	u64			ip;
 	u64			transaction;
+	s32			socket;
 	s32			cpu;
 	u8			cpumode;
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 440ba8ae888f..40073c60b83d 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -191,6 +191,7 @@ struct addr_location {
 	u8	      filtered;
 	u8	      cpumode;
 	s32	      cpu;
+	s32	      socket;
 };
 
 struct symsrc {
-- 
2.1.0


  parent reply	other threads:[~2015-09-05  1:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 01/15] perf tests: Take into account address of each objdump line Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 02/15] perf tests: Make objdump disassemble zero blocks Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 03/15] perf tests: Stop reading if objdump output crossed sections Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 04/15] perf tests: Print objdump/dso buffers if they don't match Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 05/15] tools lib api fs: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 06/15] tools lib api fs: Replace debugfs/tracefs objects interface with fs.c Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 07/15] tools lib api fs: Remove debugfs, tracefs and findfs objects Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 08/15] perf tools: Switch to tracing_path interface on appropriate places Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 09/15] perf test: Add entry to test cpu topology Arnaldo Carvalho de Melo
2015-09-05  1:06 ` Arnaldo Carvalho de Melo [this message]
2015-09-05  1:06 ` [PATCH 11/15] perf tools: Introduce new sort type "socket" for the processor socket Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 12/15] perf report: Introduce --socket-filter option Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 13/15] perf hists browser: Zoom in/out for processor socket Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 14/15] perf test: Add entry for hists socket filter Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 15/15] perf stat: Move sw clock metrics printout to stat-shadow Arnaldo Carvalho de Melo
2015-09-08 14:09 ` [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-09-08 14:21   ` Ingo Molnar
2015-09-08 14:30     ` Arnaldo Carvalho de Melo
2015-09-14  8:41       ` Ingo Molnar
2015-09-14  9:07         ` Wangnan (F)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441415203-7484-11-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.