Skip to content

Commit

Permalink
perf tools: Add processor socket info to hist_entry and addr_location
Browse files Browse the repository at this point in the history
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 <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>
Cc: Wang Nan <wangnan0@huawei.com>
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 <acme@redhat.com>
  • Loading branch information
Kan Liang authored and Arnaldo Carvalho de Melo committed Sep 14, 2015
1 parent 4cde998 commit 0c4c4de
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct hist_entry {
struct comm *comm;
u64 ip;
u64 transaction;
s32 socket;
s32 cpu;
u8 cpumode;

Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ struct addr_location {
u8 filtered;
u8 cpumode;
s32 cpu;
s32 socket;
};

struct symsrc {
Expand Down

0 comments on commit 0c4c4de

Please sign in to comment.