From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755632AbbINQnH (ORCPT ); Mon, 14 Sep 2015 12:43:07 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:50372 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755428AbbINQiw (ORCPT ); Mon, 14 Sep 2015 12:38:52 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Kan Liang , Adrian Hunter , Andi Kleen , Jiri Olsa , Namhyung Kim , Stephane Eranian , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 23/27] perf tools: Add processor socket info to hist_entry and addr_location Date: Mon, 14 Sep 2015 13:38:26 -0300 Message-Id: <1442248710-2339-24-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1442248710-2339-1-git-send-email-acme@kernel.org> References: <1442248710-2339-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang This information will come from perf.data files of from the current system, cached when needed, such as when the 'socket' sort order gets introduced. Signed-off-by: Kan Liang Cc: Adrian Hunter Cc: Andi Kleen Cc: Jiri Olsa Cc: Namhyung Kim Cc: Stephane Eranian Cc: Wang Nan Link: http://lkml.kernel.org/r/1441377946-44429-1-git-send-email-kan.liang@intel.com [ Don't blindly use env->cpu[al.cpu].socket_id & use machine->env, fixes by Jiri & Arnaldo ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 8 ++++++++ tools/perf/util/hist.c | 1 + tools/perf/util/sort.h | 1 + tools/perf/util/symbol.h | 1 + 4 files changed, 11 insertions(+) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 7ff61274ed57..497157affc9c 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1021,6 +1021,14 @@ int perf_event__preprocess_sample(const union perf_event *event, al->sym = NULL; al->cpu = sample->cpu; + al->socket = -1; + + if (al->cpu >= 0) { + struct perf_env *env = machine->env; + + if (env && env->cpu) + al->socket = env->cpu[al->cpu].socket_id; + } if (al->map) { struct dso *dso = al->map->dso; diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 48d5906a3f9f..d2b94c4c8fec 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -453,6 +453,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