diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2013-07-04 09:20:31 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-12 12:53:50 -0400 |
commit | 380512345e13c3af64e59627f1b993c4faa94a84 (patch) | |
tree | d8ea8dbe6602f88fa83b8f2b388a8dd636a68b5c /tools | |
parent | 27389d7823f573be8eaff32fb4abe564e181eb71 (diff) |
perf tools: struct thread has a tid not a pid
As evident from 'machine__process_fork_event()' and
'machine__process_exit_event()' the 'pid' member of struct thread is
actually the tid.
Rename 'pid' to 'tid' in struct thread accordingly.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1372944040-32690-13-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-kmem.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-sched.c | 12 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 4 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 6 | ||||
-rw-r--r-- | tools/perf/util/event.c | 2 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 20 | ||||
-rw-r--r-- | tools/perf/util/machine.h | 4 | ||||
-rw-r--r-- | tools/perf/util/sort.c | 6 | ||||
-rw-r--r-- | tools/perf/util/thread.c | 10 | ||||
-rw-r--r-- | tools/perf/util/thread.h | 4 |
10 files changed, 35 insertions, 35 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 0259502638b4..b49f5c58e152 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -313,7 +313,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, | |||
313 | return -1; | 313 | return -1; |
314 | } | 314 | } |
315 | 315 | ||
316 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); | 316 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->tid); |
317 | 317 | ||
318 | if (evsel->handler.func != NULL) { | 318 | if (evsel->handler.func != NULL) { |
319 | tracepoint_handler f = evsel->handler.func; | 319 | tracepoint_handler f = evsel->handler.func; |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index fba4a940ba31..948183adb6e5 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1075,7 +1075,7 @@ static int latency_migrate_task_event(struct perf_sched *sched, | |||
1075 | if (!atoms) { | 1075 | if (!atoms) { |
1076 | if (thread_atoms_insert(sched, migrant)) | 1076 | if (thread_atoms_insert(sched, migrant)) |
1077 | return -1; | 1077 | return -1; |
1078 | register_pid(sched, migrant->pid, migrant->comm); | 1078 | register_pid(sched, migrant->tid, migrant->comm); |
1079 | atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid); | 1079 | atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid); |
1080 | if (!atoms) { | 1080 | if (!atoms) { |
1081 | pr_err("migration-event: Internal tree error"); | 1081 | pr_err("migration-event: Internal tree error"); |
@@ -1115,7 +1115,7 @@ static void output_lat_thread(struct perf_sched *sched, struct work_atoms *work_ | |||
1115 | sched->all_runtime += work_list->total_runtime; | 1115 | sched->all_runtime += work_list->total_runtime; |
1116 | sched->all_count += work_list->nb_atoms; | 1116 | sched->all_count += work_list->nb_atoms; |
1117 | 1117 | ||
1118 | ret = printf(" %s:%d ", work_list->thread->comm, work_list->thread->pid); | 1118 | ret = printf(" %s:%d ", work_list->thread->comm, work_list->thread->tid); |
1119 | 1119 | ||
1120 | for (i = 0; i < 24 - ret; i++) | 1120 | for (i = 0; i < 24 - ret; i++) |
1121 | printf(" "); | 1121 | printf(" "); |
@@ -1131,9 +1131,9 @@ static void output_lat_thread(struct perf_sched *sched, struct work_atoms *work_ | |||
1131 | 1131 | ||
1132 | static int pid_cmp(struct work_atoms *l, struct work_atoms *r) | 1132 | static int pid_cmp(struct work_atoms *l, struct work_atoms *r) |
1133 | { | 1133 | { |
1134 | if (l->thread->pid < r->thread->pid) | 1134 | if (l->thread->tid < r->thread->tid) |
1135 | return -1; | 1135 | return -1; |
1136 | if (l->thread->pid > r->thread->pid) | 1136 | if (l->thread->tid > r->thread->tid) |
1137 | return 1; | 1137 | return 1; |
1138 | 1138 | ||
1139 | return 0; | 1139 | return 0; |
@@ -1321,7 +1321,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1321 | printf("*"); | 1321 | printf("*"); |
1322 | 1322 | ||
1323 | if (sched->curr_thread[cpu]) { | 1323 | if (sched->curr_thread[cpu]) { |
1324 | if (sched->curr_thread[cpu]->pid) | 1324 | if (sched->curr_thread[cpu]->tid) |
1325 | printf("%2s ", sched->curr_thread[cpu]->shortname); | 1325 | printf("%2s ", sched->curr_thread[cpu]->shortname); |
1326 | else | 1326 | else |
1327 | printf(". "); | 1327 | printf(". "); |
@@ -1332,7 +1332,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1332 | printf(" %12.6f secs ", (double)timestamp/1e9); | 1332 | printf(" %12.6f secs ", (double)timestamp/1e9); |
1333 | if (new_shortname) { | 1333 | if (new_shortname) { |
1334 | printf("%s => %s:%d\n", | 1334 | printf("%s => %s:%d\n", |
1335 | sched_in->shortname, sched_in->comm, sched_in->pid); | 1335 | sched_in->shortname, sched_in->comm, sched_in->tid); |
1336 | } else { | 1336 | } else { |
1337 | printf("\n"); | 1337 | printf("\n"); |
1338 | } | 1338 | } |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 87fc7d08ca02..0e4b67f6bbd1 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -142,7 +142,7 @@ static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thre | |||
142 | printed += fprintf_duration(duration, fp); | 142 | printed += fprintf_duration(duration, fp); |
143 | 143 | ||
144 | if (trace->multiple_threads) | 144 | if (trace->multiple_threads) |
145 | printed += fprintf(fp, "%d ", thread->pid); | 145 | printed += fprintf(fp, "%d ", thread->tid); |
146 | 146 | ||
147 | return printed; | 147 | return printed; |
148 | } | 148 | } |
@@ -593,7 +593,7 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp) | |||
593 | color = PERF_COLOR_YELLOW; | 593 | color = PERF_COLOR_YELLOW; |
594 | 594 | ||
595 | printed += color_fprintf(fp, color, "%20s", thread->comm); | 595 | printed += color_fprintf(fp, color, "%20s", thread->comm); |
596 | printed += fprintf(fp, " - %-5d :%11lu [", thread->pid, ttrace->nr_events); | 596 | printed += fprintf(fp, " - %-5d :%11lu [", thread->tid, ttrace->nr_events); |
597 | printed += color_fprintf(fp, color, "%5.1f%%", ratio); | 597 | printed += color_fprintf(fp, color, "%5.1f%%", ratio); |
598 | printed += fprintf(fp, " ] %10.3f ms\n", ttrace->runtime_ms); | 598 | printed += fprintf(fp, " ] %10.3f ms\n", ttrace->runtime_ms); |
599 | } | 599 | } |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index fc0bd3843d34..06e892f1f8ca 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1256,7 +1256,7 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size, | |||
1256 | printed += scnprintf(bf + printed, size - printed, | 1256 | printed += scnprintf(bf + printed, size - printed, |
1257 | ", Thread: %s(%d)", | 1257 | ", Thread: %s(%d)", |
1258 | (thread->comm_set ? thread->comm : ""), | 1258 | (thread->comm_set ? thread->comm : ""), |
1259 | thread->pid); | 1259 | thread->tid); |
1260 | if (dso) | 1260 | if (dso) |
1261 | printed += scnprintf(bf + printed, size - printed, | 1261 | printed += scnprintf(bf + printed, size - printed, |
1262 | ", DSO: %s", dso->short_name); | 1262 | ", DSO: %s", dso->short_name); |
@@ -1579,7 +1579,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1579 | asprintf(&options[nr_options], "Zoom %s %s(%d) thread", | 1579 | asprintf(&options[nr_options], "Zoom %s %s(%d) thread", |
1580 | (browser->hists->thread_filter ? "out of" : "into"), | 1580 | (browser->hists->thread_filter ? "out of" : "into"), |
1581 | (thread->comm_set ? thread->comm : ""), | 1581 | (thread->comm_set ? thread->comm : ""), |
1582 | thread->pid) > 0) | 1582 | thread->tid) > 0) |
1583 | zoom_thread = nr_options++; | 1583 | zoom_thread = nr_options++; |
1584 | 1584 | ||
1585 | if (dso != NULL && | 1585 | if (dso != NULL && |
@@ -1702,7 +1702,7 @@ zoom_out_thread: | |||
1702 | } else { | 1702 | } else { |
1703 | ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"", | 1703 | ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"", |
1704 | thread->comm_set ? thread->comm : "", | 1704 | thread->comm_set ? thread->comm : "", |
1705 | thread->pid); | 1705 | thread->tid); |
1706 | browser->hists->thread_filter = thread; | 1706 | browser->hists->thread_filter = thread; |
1707 | sort_thread.elide = true; | 1707 | sort_thread.elide = true; |
1708 | pstack__push(fstack, &browser->hists->thread_filter); | 1708 | pstack__push(fstack, &browser->hists->thread_filter); |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 5cd13d768cec..95412705d0d2 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -686,7 +686,7 @@ int perf_event__preprocess_sample(const union perf_event *event, | |||
686 | !strlist__has_entry(symbol_conf.comm_list, thread->comm)) | 686 | !strlist__has_entry(symbol_conf.comm_list, thread->comm)) |
687 | goto out_filtered; | 687 | goto out_filtered; |
688 | 688 | ||
689 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); | 689 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->tid); |
690 | /* | 690 | /* |
691 | * Have we already created the kernel maps for this machine? | 691 | * Have we already created the kernel maps for this machine? |
692 | * | 692 | * |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 93527afb09d5..5dd5026a82ef 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -233,7 +233,7 @@ void machines__set_id_hdr_size(struct machines *machines, u16 id_hdr_size) | |||
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | static struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, | 236 | static struct thread *__machine__findnew_thread(struct machine *machine, pid_t tid, |
237 | bool create) | 237 | bool create) |
238 | { | 238 | { |
239 | struct rb_node **p = &machine->threads.rb_node; | 239 | struct rb_node **p = &machine->threads.rb_node; |
@@ -241,23 +241,23 @@ static struct thread *__machine__findnew_thread(struct machine *machine, pid_t p | |||
241 | struct thread *th; | 241 | struct thread *th; |
242 | 242 | ||
243 | /* | 243 | /* |
244 | * Font-end cache - PID lookups come in blocks, | 244 | * Front-end cache - TID lookups come in blocks, |
245 | * so most of the time we dont have to look up | 245 | * so most of the time we dont have to look up |
246 | * the full rbtree: | 246 | * the full rbtree: |
247 | */ | 247 | */ |
248 | if (machine->last_match && machine->last_match->pid == pid) | 248 | if (machine->last_match && machine->last_match->tid == tid) |
249 | return machine->last_match; | 249 | return machine->last_match; |
250 | 250 | ||
251 | while (*p != NULL) { | 251 | while (*p != NULL) { |
252 | parent = *p; | 252 | parent = *p; |
253 | th = rb_entry(parent, struct thread, rb_node); | 253 | th = rb_entry(parent, struct thread, rb_node); |
254 | 254 | ||
255 | if (th->pid == pid) { | 255 | if (th->tid == tid) { |
256 | machine->last_match = th; | 256 | machine->last_match = th; |
257 | return th; | 257 | return th; |
258 | } | 258 | } |
259 | 259 | ||
260 | if (pid < th->pid) | 260 | if (tid < th->tid) |
261 | p = &(*p)->rb_left; | 261 | p = &(*p)->rb_left; |
262 | else | 262 | else |
263 | p = &(*p)->rb_right; | 263 | p = &(*p)->rb_right; |
@@ -266,7 +266,7 @@ static struct thread *__machine__findnew_thread(struct machine *machine, pid_t p | |||
266 | if (!create) | 266 | if (!create) |
267 | return NULL; | 267 | return NULL; |
268 | 268 | ||
269 | th = thread__new(pid); | 269 | th = thread__new(tid); |
270 | if (th != NULL) { | 270 | if (th != NULL) { |
271 | rb_link_node(&th->rb_node, parent, p); | 271 | rb_link_node(&th->rb_node, parent, p); |
272 | rb_insert_color(&th->rb_node, &machine->threads); | 272 | rb_insert_color(&th->rb_node, &machine->threads); |
@@ -276,14 +276,14 @@ static struct thread *__machine__findnew_thread(struct machine *machine, pid_t p | |||
276 | return th; | 276 | return th; |
277 | } | 277 | } |
278 | 278 | ||
279 | struct thread *machine__findnew_thread(struct machine *machine, pid_t pid) | 279 | struct thread *machine__findnew_thread(struct machine *machine, pid_t tid) |
280 | { | 280 | { |
281 | return __machine__findnew_thread(machine, pid, true); | 281 | return __machine__findnew_thread(machine, tid, true); |
282 | } | 282 | } |
283 | 283 | ||
284 | struct thread *machine__find_thread(struct machine *machine, pid_t pid) | 284 | struct thread *machine__find_thread(struct machine *machine, pid_t tid) |
285 | { | 285 | { |
286 | return __machine__findnew_thread(machine, pid, false); | 286 | return __machine__findnew_thread(machine, tid, false); |
287 | } | 287 | } |
288 | 288 | ||
289 | int machine__process_comm_event(struct machine *machine, union perf_event *event) | 289 | int machine__process_comm_event(struct machine *machine, union perf_event *event) |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index 77940680f1fc..e49ba01b7937 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
@@ -36,7 +36,7 @@ struct map *machine__kernel_map(struct machine *machine, enum map_type type) | |||
36 | return machine->vmlinux_maps[type]; | 36 | return machine->vmlinux_maps[type]; |
37 | } | 37 | } |
38 | 38 | ||
39 | struct thread *machine__find_thread(struct machine *machine, pid_t pid); | 39 | struct thread *machine__find_thread(struct machine *machine, pid_t tid); |
40 | 40 | ||
41 | int machine__process_comm_event(struct machine *machine, union perf_event *event); | 41 | int machine__process_comm_event(struct machine *machine, union perf_event *event); |
42 | int machine__process_exit_event(struct machine *machine, union perf_event *event); | 42 | int machine__process_exit_event(struct machine *machine, union perf_event *event); |
@@ -99,7 +99,7 @@ static inline bool machine__is_host(struct machine *machine) | |||
99 | return machine ? machine->pid == HOST_KERNEL_ID : false; | 99 | return machine ? machine->pid == HOST_KERNEL_ID : false; |
100 | } | 100 | } |
101 | 101 | ||
102 | struct thread *machine__findnew_thread(struct machine *machine, pid_t pid); | 102 | struct thread *machine__findnew_thread(struct machine *machine, pid_t tid); |
103 | 103 | ||
104 | size_t machine__fprintf(struct machine *machine, FILE *fp); | 104 | size_t machine__fprintf(struct machine *machine, FILE *fp); |
105 | 105 | ||
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 313a5a730112..8deee19d2e7f 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -55,14 +55,14 @@ static int64_t cmp_null(void *l, void *r) | |||
55 | static int64_t | 55 | static int64_t |
56 | sort__thread_cmp(struct hist_entry *left, struct hist_entry *right) | 56 | sort__thread_cmp(struct hist_entry *left, struct hist_entry *right) |
57 | { | 57 | { |
58 | return right->thread->pid - left->thread->pid; | 58 | return right->thread->tid - left->thread->tid; |
59 | } | 59 | } |
60 | 60 | ||
61 | static int hist_entry__thread_snprintf(struct hist_entry *self, char *bf, | 61 | static int hist_entry__thread_snprintf(struct hist_entry *self, char *bf, |
62 | size_t size, unsigned int width) | 62 | size_t size, unsigned int width) |
63 | { | 63 | { |
64 | return repsep_snprintf(bf, size, "%*s:%5d", width - 6, | 64 | return repsep_snprintf(bf, size, "%*s:%5d", width - 6, |
65 | self->thread->comm ?: "", self->thread->pid); | 65 | self->thread->comm ?: "", self->thread->tid); |
66 | } | 66 | } |
67 | 67 | ||
68 | struct sort_entry sort_thread = { | 68 | struct sort_entry sort_thread = { |
@@ -77,7 +77,7 @@ struct sort_entry sort_thread = { | |||
77 | static int64_t | 77 | static int64_t |
78 | sort__comm_cmp(struct hist_entry *left, struct hist_entry *right) | 78 | sort__comm_cmp(struct hist_entry *left, struct hist_entry *right) |
79 | { | 79 | { |
80 | return right->thread->pid - left->thread->pid; | 80 | return right->thread->tid - left->thread->tid; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int64_t | 83 | static int64_t |
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 40399cbcca77..6feeb88eb5b0 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -7,17 +7,17 @@ | |||
7 | #include "util.h" | 7 | #include "util.h" |
8 | #include "debug.h" | 8 | #include "debug.h" |
9 | 9 | ||
10 | struct thread *thread__new(pid_t pid) | 10 | struct thread *thread__new(pid_t tid) |
11 | { | 11 | { |
12 | struct thread *self = zalloc(sizeof(*self)); | 12 | struct thread *self = zalloc(sizeof(*self)); |
13 | 13 | ||
14 | if (self != NULL) { | 14 | if (self != NULL) { |
15 | map_groups__init(&self->mg); | 15 | map_groups__init(&self->mg); |
16 | self->pid = pid; | 16 | self->tid = tid; |
17 | self->ppid = -1; | 17 | self->ppid = -1; |
18 | self->comm = malloc(32); | 18 | self->comm = malloc(32); |
19 | if (self->comm) | 19 | if (self->comm) |
20 | snprintf(self->comm, 32, ":%d", self->pid); | 20 | snprintf(self->comm, 32, ":%d", self->tid); |
21 | } | 21 | } |
22 | 22 | ||
23 | return self; | 23 | return self; |
@@ -57,7 +57,7 @@ int thread__comm_len(struct thread *self) | |||
57 | 57 | ||
58 | size_t thread__fprintf(struct thread *thread, FILE *fp) | 58 | size_t thread__fprintf(struct thread *thread, FILE *fp) |
59 | { | 59 | { |
60 | return fprintf(fp, "Thread %d %s\n", thread->pid, thread->comm) + | 60 | return fprintf(fp, "Thread %d %s\n", thread->tid, thread->comm) + |
61 | map_groups__fprintf(&thread->mg, verbose, fp); | 61 | map_groups__fprintf(&thread->mg, verbose, fp); |
62 | } | 62 | } |
63 | 63 | ||
@@ -84,7 +84,7 @@ int thread__fork(struct thread *self, struct thread *parent) | |||
84 | if (map_groups__clone(&self->mg, &parent->mg, i) < 0) | 84 | if (map_groups__clone(&self->mg, &parent->mg, i) < 0) |
85 | return -ENOMEM; | 85 | return -ENOMEM; |
86 | 86 | ||
87 | self->ppid = parent->pid; | 87 | self->ppid = parent->tid; |
88 | 88 | ||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 5e7ba35a5517..0fe1f9c05865 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h | |||
@@ -12,7 +12,7 @@ struct thread { | |||
12 | struct list_head node; | 12 | struct list_head node; |
13 | }; | 13 | }; |
14 | struct map_groups mg; | 14 | struct map_groups mg; |
15 | pid_t pid; | 15 | pid_t tid; |
16 | pid_t ppid; | 16 | pid_t ppid; |
17 | char shortname[3]; | 17 | char shortname[3]; |
18 | bool comm_set; | 18 | bool comm_set; |
@@ -24,7 +24,7 @@ struct thread { | |||
24 | 24 | ||
25 | struct machine; | 25 | struct machine; |
26 | 26 | ||
27 | struct thread *thread__new(pid_t pid); | 27 | struct thread *thread__new(pid_t tid); |
28 | void thread__delete(struct thread *self); | 28 | void thread__delete(struct thread *self); |
29 | 29 | ||
30 | int thread__set_comm(struct thread *self, const char *comm); | 30 | int thread__set_comm(struct thread *self, const char *comm); |