Skip to content

Commit bf49c35

Browse files
ahunter6acmel
authored andcommitted
perf tools: Add cpu to struct thread
Tools may wish to track on which cpu a thread is running. Add 'cpu' to struct thread for that purpose. This will be used to determine the cpu when decoding a per-thread Instruction Trace. E.g: Intel PT decoding uses sched_switch events to determine which task is running on which cpu. The Intel PT data comes straight from the hardware which doesn't know about linux threads. Signed-off-by: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 1f625b0 commit bf49c35

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

tools/perf/util/thread.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct thread *thread__new(pid_t pid, pid_t tid)
3434
thread->pid_ = pid;
3535
thread->tid = tid;
3636
thread->ppid = -1;
37+
thread->cpu = -1;
3738
INIT_LIST_HEAD(&thread->comm_list);
3839

3940
comm_str = malloc(32);

tools/perf/util/thread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct thread {
1717
pid_t pid_; /* Not all tools update this */
1818
pid_t tid;
1919
pid_t ppid;
20+
int cpu;
2021
char shortname[3];
2122
bool comm_set;
2223
bool dead; /* if set thread has exited */

0 commit comments

Comments
 (0)