diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 7ff61274ed57f..497157affc9c2 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 48d5906a3f9f9..d2b94c4c8fec3 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 3c2a399f8f5b9..7cf1cf7d2406d 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 440ba8ae888f0..40073c60b83d6 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 {