]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - tools/perf/util/event.c
perf record: Synthesize COMM event for a command line workload
[linux.git] / tools / perf / util / event.c
index 7ff61274ed57f5219416c69767fac9acca21e091..6214ad47d5540c21314407b1fc7683700de890ee 100644 (file)
@@ -167,7 +167,7 @@ static int perf_event__prepare_comm(union perf_event *event, pid_t pid,
        return 0;
 }
 
-static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
+pid_t perf_event__synthesize_comm(struct perf_tool *tool,
                                         union perf_event *event, pid_t pid,
                                         perf_event__handler_t process,
                                         struct machine *machine)
@@ -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;