aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-10-22 18:01:31 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-10-23 08:55:37 -0400
commitc824c4338ac47979c69ba6f8faab33670ae179df (patch)
tree909cc9e0aa8d40aebb0a9255ebd816d3a83b8812
parent4ac2f1c1014a121f1493a9d5207258793c576438 (diff)
perf tools: Stop using 'self' in some more places
As suggested by tglx, 'self' should be replaced by something that is more useful. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-fmblhc6tbb99tk1q8vowtsbj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-annotate.c4
-rw-r--r--tools/perf/builtin-diff.c5
-rw-r--r--tools/perf/builtin-inject.c22
-rw-r--r--tools/perf/builtin-report.c14
-rw-r--r--tools/perf/util/build-id.c6
-rw-r--r--tools/perf/util/hist.c18
-rw-r--r--tools/perf/util/sort.c124
-rw-r--r--tools/perf/util/strfilter.c46
-rw-r--r--tools/perf/util/thread.c72
9 files changed, 155 insertions, 156 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 03cfa592071f..17c6b494e8cc 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -118,11 +118,11 @@ static int hist_entry__tty_annotate(struct hist_entry *he,
118 ann->print_line, ann->full_paths, 0, 0); 118 ann->print_line, ann->full_paths, 0, 0);
119} 119}
120 120
121static void hists__find_annotations(struct hists *self, 121static void hists__find_annotations(struct hists *hists,
122 struct perf_evsel *evsel, 122 struct perf_evsel *evsel,
123 struct perf_annotate *ann) 123 struct perf_annotate *ann)
124{ 124{
125 struct rb_node *nd = rb_first(&self->entries), *next; 125 struct rb_node *nd = rb_first(&hists->entries), *next;
126 int key = K_RIGHT; 126 int key = K_RIGHT;
127 127
128 while (nd) { 128 while (nd) {
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 419d27dd708b..9c828881714c 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -303,12 +303,11 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,
303 return -1; 303 return -1;
304} 304}
305 305
306static int hists__add_entry(struct hists *self, 306static int hists__add_entry(struct hists *hists,
307 struct addr_location *al, u64 period, 307 struct addr_location *al, u64 period,
308 u64 weight, u64 transaction) 308 u64 weight, u64 transaction)
309{ 309{
310 if (__hists__add_entry(self, al, NULL, period, weight, transaction) 310 if (__hists__add_entry(hists, al, NULL, period, weight, transaction) != NULL)
311 != NULL)
312 return 0; 311 return 0;
313 return -ENOMEM; 312 return -ENOMEM;
314} 313}
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 4aa6d7850bcc..eb1a5941912b 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -162,38 +162,38 @@ static int perf_event__repipe_tracing_data(struct perf_tool *tool,
162 return err; 162 return err;
163} 163}
164 164
165static int dso__read_build_id(struct dso *self) 165static int dso__read_build_id(struct dso *dso)
166{ 166{
167 if (self->has_build_id) 167 if (dso->has_build_id)
168 return 0; 168 return 0;
169 169
170 if (filename__read_build_id(self->long_name, self->build_id, 170 if (filename__read_build_id(dso->long_name, dso->build_id,
171 sizeof(self->build_id)) > 0) { 171 sizeof(dso->build_id)) > 0) {
172 self->has_build_id = true; 172 dso->has_build_id = true;
173 return 0; 173 return 0;
174 } 174 }
175 175
176 return -1; 176 return -1;
177} 177}
178 178
179static int dso__inject_build_id(struct dso *self, struct perf_tool *tool, 179static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool,
180 struct machine *machine) 180 struct machine *machine)
181{ 181{
182 u16 misc = PERF_RECORD_MISC_USER; 182 u16 misc = PERF_RECORD_MISC_USER;
183 int err; 183 int err;
184 184
185 if (dso__read_build_id(self) < 0) { 185 if (dso__read_build_id(dso) < 0) {
186 pr_debug("no build_id found for %s\n", self->long_name); 186 pr_debug("no build_id found for %s\n", dso->long_name);
187 return -1; 187 return -1;
188 } 188 }
189 189
190 if (self->kernel) 190 if (dso->kernel)
191 misc = PERF_RECORD_MISC_KERNEL; 191 misc = PERF_RECORD_MISC_KERNEL;
192 192
193 err = perf_event__synthesize_build_id(tool, self, misc, perf_event__repipe, 193 err = perf_event__synthesize_build_id(tool, dso, misc, perf_event__repipe,
194 machine); 194 machine);
195 if (err) { 195 if (err) {
196 pr_err("Can't synthesize build_id event for %s\n", self->long_name); 196 pr_err("Can't synthesize build_id event for %s\n", dso->long_name);
197 return -1; 197 return -1;
198 } 198 }
199 199
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 81addcabb356..e3598a456017 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -373,9 +373,9 @@ static int process_read_event(struct perf_tool *tool,
373/* For pipe mode, sample_type is not currently set */ 373/* For pipe mode, sample_type is not currently set */
374static int perf_report__setup_sample_type(struct perf_report *rep) 374static int perf_report__setup_sample_type(struct perf_report *rep)
375{ 375{
376 struct perf_session *self = rep->session; 376 struct perf_session *session = rep->session;
377 u64 sample_type = perf_evlist__combined_sample_type(self->evlist); 377 u64 sample_type = perf_evlist__combined_sample_type(session->evlist);
378 bool is_pipe = perf_data_file__is_pipe(self->file); 378 bool is_pipe = perf_data_file__is_pipe(session->file);
379 379
380 if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) { 380 if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
381 if (sort__has_parent) { 381 if (sort__has_parent) {
@@ -417,14 +417,14 @@ static void sig_handler(int sig __maybe_unused)
417} 417}
418 418
419static size_t hists__fprintf_nr_sample_events(struct perf_report *rep, 419static size_t hists__fprintf_nr_sample_events(struct perf_report *rep,
420 struct hists *self, 420 struct hists *hists,
421 const char *evname, FILE *fp) 421 const char *evname, FILE *fp)
422{ 422{
423 size_t ret; 423 size_t ret;
424 char unit; 424 char unit;
425 unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE]; 425 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
426 u64 nr_events = self->stats.total_period; 426 u64 nr_events = hists->stats.total_period;
427 struct perf_evsel *evsel = hists_to_evsel(self); 427 struct perf_evsel *evsel = hists_to_evsel(hists);
428 char buf[512]; 428 char buf[512];
429 size_t size = sizeof(buf); 429 size_t size = sizeof(buf);
430 430
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 7ded71d19d75..a92770c98cc7 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -89,14 +89,14 @@ int build_id__sprintf(const u8 *build_id, int len, char *bf)
89 return raw - build_id; 89 return raw - build_id;
90} 90}
91 91
92char *dso__build_id_filename(struct dso *self, char *bf, size_t size) 92char *dso__build_id_filename(struct dso *dso, char *bf, size_t size)
93{ 93{
94 char build_id_hex[BUILD_ID_SIZE * 2 + 1]; 94 char build_id_hex[BUILD_ID_SIZE * 2 + 1];
95 95
96 if (!self->has_build_id) 96 if (!dso->has_build_id)
97 return NULL; 97 return NULL;
98 98
99 build_id__sprintf(self->build_id, sizeof(self->build_id), build_id_hex); 99 build_id__sprintf(dso->build_id, sizeof(dso->build_id), build_id_hex);
100 if (bf == NULL) { 100 if (bf == NULL) {
101 if (asprintf(&bf, "%s/.build-id/%.2s/%s", buildid_dir, 101 if (asprintf(&bf, "%s/.build-id/%.2s/%s", buildid_dir,
102 build_id_hex, build_id_hex + 2) < 0) 102 build_id_hex, build_id_hex + 2) < 0)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index cca03831f41a..f0b863ef4896 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -406,7 +406,7 @@ out:
406 return he; 406 return he;
407} 407}
408 408
409struct hist_entry *__hists__add_mem_entry(struct hists *self, 409struct hist_entry *__hists__add_mem_entry(struct hists *hists,
410 struct addr_location *al, 410 struct addr_location *al,
411 struct symbol *sym_parent, 411 struct symbol *sym_parent,
412 struct mem_info *mi, 412 struct mem_info *mi,
@@ -429,14 +429,14 @@ struct hist_entry *__hists__add_mem_entry(struct hists *self,
429 .level = al->level, 429 .level = al->level,
430 .parent = sym_parent, 430 .parent = sym_parent,
431 .filtered = symbol__parent_filter(sym_parent), 431 .filtered = symbol__parent_filter(sym_parent),
432 .hists = self, 432 .hists = hists,
433 .mem_info = mi, 433 .mem_info = mi,
434 .branch_info = NULL, 434 .branch_info = NULL,
435 }; 435 };
436 return add_hist_entry(self, &entry, al, period, weight); 436 return add_hist_entry(hists, &entry, al, period, weight);
437} 437}
438 438
439struct hist_entry *__hists__add_branch_entry(struct hists *self, 439struct hist_entry *__hists__add_branch_entry(struct hists *hists,
440 struct addr_location *al, 440 struct addr_location *al,
441 struct symbol *sym_parent, 441 struct symbol *sym_parent,
442 struct branch_info *bi, 442 struct branch_info *bi,
@@ -460,14 +460,14 @@ struct hist_entry *__hists__add_branch_entry(struct hists *self,
460 .parent = sym_parent, 460 .parent = sym_parent,
461 .filtered = symbol__parent_filter(sym_parent), 461 .filtered = symbol__parent_filter(sym_parent),
462 .branch_info = bi, 462 .branch_info = bi,
463 .hists = self, 463 .hists = hists,
464 .mem_info = NULL, 464 .mem_info = NULL,
465 }; 465 };
466 466
467 return add_hist_entry(self, &entry, al, period, weight); 467 return add_hist_entry(hists, &entry, al, period, weight);
468} 468}
469 469
470struct hist_entry *__hists__add_entry(struct hists *self, 470struct hist_entry *__hists__add_entry(struct hists *hists,
471 struct addr_location *al, 471 struct addr_location *al,
472 struct symbol *sym_parent, u64 period, 472 struct symbol *sym_parent, u64 period,
473 u64 weight, u64 transaction) 473 u64 weight, u64 transaction)
@@ -488,13 +488,13 @@ struct hist_entry *__hists__add_entry(struct hists *self,
488 }, 488 },
489 .parent = sym_parent, 489 .parent = sym_parent,
490 .filtered = symbol__parent_filter(sym_parent), 490 .filtered = symbol__parent_filter(sym_parent),
491 .hists = self, 491 .hists = hists,
492 .branch_info = NULL, 492 .branch_info = NULL,
493 .mem_info = NULL, 493 .mem_info = NULL,
494 .transaction = transaction, 494 .transaction = transaction,
495 }; 495 };
496 496
497 return add_hist_entry(self, &entry, al, period, weight); 497 return add_hist_entry(hists, &entry, al, period, weight);
498} 498}
499 499
500int64_t 500int64_t
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 1f9821db9e77..19b4aa279d1e 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -60,11 +60,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
60 return right->thread->tid - left->thread->tid; 60 return right->thread->tid - left->thread->tid;
61} 61}
62 62
63static int hist_entry__thread_snprintf(struct hist_entry *self, char *bf, 63static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
64 size_t size, unsigned int width) 64 size_t size, unsigned int width)
65{ 65{
66 return repsep_snprintf(bf, size, "%*s:%5d", width - 6, 66 return repsep_snprintf(bf, size, "%*s:%5d", width - 6,
67 self->thread->comm ?: "", self->thread->tid); 67 he->thread->comm ?: "", he->thread->tid);
68} 68}
69 69
70struct sort_entry sort_thread = { 70struct sort_entry sort_thread = {
@@ -94,10 +94,10 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
94 return strcmp(comm_l, comm_r); 94 return strcmp(comm_l, comm_r);
95} 95}
96 96
97static int hist_entry__comm_snprintf(struct hist_entry *self, char *bf, 97static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
98 size_t size, unsigned int width) 98 size_t size, unsigned int width)
99{ 99{
100 return repsep_snprintf(bf, size, "%*s", width, self->thread->comm); 100 return repsep_snprintf(bf, size, "%*s", width, he->thread->comm);
101} 101}
102 102
103struct sort_entry sort_comm = { 103struct sort_entry sort_comm = {
@@ -148,10 +148,10 @@ static int _hist_entry__dso_snprintf(struct map *map, char *bf,
148 return repsep_snprintf(bf, size, "%-*s", width, "[unknown]"); 148 return repsep_snprintf(bf, size, "%-*s", width, "[unknown]");
149} 149}
150 150
151static int hist_entry__dso_snprintf(struct hist_entry *self, char *bf, 151static int hist_entry__dso_snprintf(struct hist_entry *he, char *bf,
152 size_t size, unsigned int width) 152 size_t size, unsigned int width)
153{ 153{
154 return _hist_entry__dso_snprintf(self->ms.map, bf, size, width); 154 return _hist_entry__dso_snprintf(he->ms.map, bf, size, width);
155} 155}
156 156
157struct sort_entry sort_dso = { 157struct sort_entry sort_dso = {
@@ -234,11 +234,11 @@ static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
234 return ret; 234 return ret;
235} 235}
236 236
237static int hist_entry__sym_snprintf(struct hist_entry *self, char *bf, 237static int hist_entry__sym_snprintf(struct hist_entry *he, char *bf,
238 size_t size, unsigned int width) 238 size_t size, unsigned int width)
239{ 239{
240 return _hist_entry__sym_snprintf(self->ms.map, self->ms.sym, self->ip, 240 return _hist_entry__sym_snprintf(he->ms.map, he->ms.sym, he->ip,
241 self->level, bf, size, width); 241 he->level, bf, size, width);
242} 242}
243 243
244struct sort_entry sort_sym = { 244struct sort_entry sort_sym = {
@@ -274,11 +274,11 @@ sort__srcline_cmp(struct hist_entry *left, struct hist_entry *right)
274 return strcmp(left->srcline, right->srcline); 274 return strcmp(left->srcline, right->srcline);
275} 275}
276 276
277static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf, 277static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
278 size_t size, 278 size_t size,
279 unsigned int width __maybe_unused) 279 unsigned int width __maybe_unused)
280{ 280{
281 return repsep_snprintf(bf, size, "%s", self->srcline); 281 return repsep_snprintf(bf, size, "%s", he->srcline);
282} 282}
283 283
284struct sort_entry sort_srcline = { 284struct sort_entry sort_srcline = {
@@ -302,11 +302,11 @@ sort__parent_cmp(struct hist_entry *left, struct hist_entry *right)
302 return strcmp(sym_l->name, sym_r->name); 302 return strcmp(sym_l->name, sym_r->name);
303} 303}
304 304
305static int hist_entry__parent_snprintf(struct hist_entry *self, char *bf, 305static int hist_entry__parent_snprintf(struct hist_entry *he, char *bf,
306 size_t size, unsigned int width) 306 size_t size, unsigned int width)
307{ 307{
308 return repsep_snprintf(bf, size, "%-*s", width, 308 return repsep_snprintf(bf, size, "%-*s", width,
309 self->parent ? self->parent->name : "[other]"); 309 he->parent ? he->parent->name : "[other]");
310} 310}
311 311
312struct sort_entry sort_parent = { 312struct sort_entry sort_parent = {
@@ -324,10 +324,10 @@ sort__cpu_cmp(struct hist_entry *left, struct hist_entry *right)
324 return right->cpu - left->cpu; 324 return right->cpu - left->cpu;
325} 325}
326 326
327static int hist_entry__cpu_snprintf(struct hist_entry *self, char *bf, 327static int hist_entry__cpu_snprintf(struct hist_entry *he, char *bf,
328 size_t size, unsigned int width) 328 size_t size, unsigned int width)
329{ 329{
330 return repsep_snprintf(bf, size, "%*d", width, self->cpu); 330 return repsep_snprintf(bf, size, "%*d", width, he->cpu);
331} 331}
332 332
333struct sort_entry sort_cpu = { 333struct sort_entry sort_cpu = {
@@ -346,10 +346,10 @@ sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right)
346 right->branch_info->from.map); 346 right->branch_info->from.map);
347} 347}
348 348
349static int hist_entry__dso_from_snprintf(struct hist_entry *self, char *bf, 349static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf,
350 size_t size, unsigned int width) 350 size_t size, unsigned int width)
351{ 351{
352 return _hist_entry__dso_snprintf(self->branch_info->from.map, 352 return _hist_entry__dso_snprintf(he->branch_info->from.map,
353 bf, size, width); 353 bf, size, width);
354} 354}
355 355
@@ -360,10 +360,10 @@ sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right)
360 right->branch_info->to.map); 360 right->branch_info->to.map);
361} 361}
362 362
363static int hist_entry__dso_to_snprintf(struct hist_entry *self, char *bf, 363static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf,
364 size_t size, unsigned int width) 364 size_t size, unsigned int width)
365{ 365{
366 return _hist_entry__dso_snprintf(self->branch_info->to.map, 366 return _hist_entry__dso_snprintf(he->branch_info->to.map,
367 bf, size, width); 367 bf, size, width);
368} 368}
369 369
@@ -391,21 +391,21 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
391 return _sort__sym_cmp(to_l->sym, to_r->sym); 391 return _sort__sym_cmp(to_l->sym, to_r->sym);
392} 392}
393 393
394static int hist_entry__sym_from_snprintf(struct hist_entry *self, char *bf, 394static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
395 size_t size, unsigned int width) 395 size_t size, unsigned int width)
396{ 396{
397 struct addr_map_symbol *from = &self->branch_info->from; 397 struct addr_map_symbol *from = &he->branch_info->from;
398 return _hist_entry__sym_snprintf(from->map, from->sym, from->addr, 398 return _hist_entry__sym_snprintf(from->map, from->sym, from->addr,
399 self->level, bf, size, width); 399 he->level, bf, size, width);
400 400
401} 401}
402 402
403static int hist_entry__sym_to_snprintf(struct hist_entry *self, char *bf, 403static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
404 size_t size, unsigned int width) 404 size_t size, unsigned int width)
405{ 405{
406 struct addr_map_symbol *to = &self->branch_info->to; 406 struct addr_map_symbol *to = &he->branch_info->to;
407 return _hist_entry__sym_snprintf(to->map, to->sym, to->addr, 407 return _hist_entry__sym_snprintf(to->map, to->sym, to->addr,
408 self->level, bf, size, width); 408 he->level, bf, size, width);
409 409
410} 410}
411 411
@@ -448,13 +448,13 @@ sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right)
448 return mp || p; 448 return mp || p;
449} 449}
450 450
451static int hist_entry__mispredict_snprintf(struct hist_entry *self, char *bf, 451static int hist_entry__mispredict_snprintf(struct hist_entry *he, char *bf,
452 size_t size, unsigned int width){ 452 size_t size, unsigned int width){
453 static const char *out = "N/A"; 453 static const char *out = "N/A";
454 454
455 if (self->branch_info->flags.predicted) 455 if (he->branch_info->flags.predicted)
456 out = "N"; 456 out = "N";
457 else if (self->branch_info->flags.mispred) 457 else if (he->branch_info->flags.mispred)
458 out = "Y"; 458 out = "Y";
459 459
460 return repsep_snprintf(bf, size, "%-*s", width, out); 460 return repsep_snprintf(bf, size, "%-*s", width, out);
@@ -474,19 +474,19 @@ sort__daddr_cmp(struct hist_entry *left, struct hist_entry *right)
474 return (int64_t)(r - l); 474 return (int64_t)(r - l);
475} 475}
476 476
477static int hist_entry__daddr_snprintf(struct hist_entry *self, char *bf, 477static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf,
478 size_t size, unsigned int width) 478 size_t size, unsigned int width)
479{ 479{
480 uint64_t addr = 0; 480 uint64_t addr = 0;
481 struct map *map = NULL; 481 struct map *map = NULL;
482 struct symbol *sym = NULL; 482 struct symbol *sym = NULL;
483 483
484 if (self->mem_info) { 484 if (he->mem_info) {
485 addr = self->mem_info->daddr.addr; 485 addr = he->mem_info->daddr.addr;
486 map = self->mem_info->daddr.map; 486 map = he->mem_info->daddr.map;
487 sym = self->mem_info->daddr.sym; 487 sym = he->mem_info->daddr.sym;
488 } 488 }
489 return _hist_entry__sym_snprintf(map, sym, addr, self->level, bf, size, 489 return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
490 width); 490 width);
491} 491}
492 492
@@ -504,13 +504,13 @@ sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
504 return _sort__dso_cmp(map_l, map_r); 504 return _sort__dso_cmp(map_l, map_r);
505} 505}
506 506
507static int hist_entry__dso_daddr_snprintf(struct hist_entry *self, char *bf, 507static int hist_entry__dso_daddr_snprintf(struct hist_entry *he, char *bf,
508 size_t size, unsigned int width) 508 size_t size, unsigned int width)
509{ 509{
510 struct map *map = NULL; 510 struct map *map = NULL;
511 511
512 if (self->mem_info) 512 if (he->mem_info)
513 map = self->mem_info->daddr.map; 513 map = he->mem_info->daddr.map;
514 514
515 return _hist_entry__dso_snprintf(map, bf, size, width); 515 return _hist_entry__dso_snprintf(map, bf, size, width);
516} 516}
@@ -534,14 +534,14 @@ sort__locked_cmp(struct hist_entry *left, struct hist_entry *right)
534 return (int64_t)(data_src_r.mem_lock - data_src_l.mem_lock); 534 return (int64_t)(data_src_r.mem_lock - data_src_l.mem_lock);
535} 535}
536 536
537static int hist_entry__locked_snprintf(struct hist_entry *self, char *bf, 537static int hist_entry__locked_snprintf(struct hist_entry *he, char *bf,
538 size_t size, unsigned int width) 538 size_t size, unsigned int width)
539{ 539{
540 const char *out; 540 const char *out;
541 u64 mask = PERF_MEM_LOCK_NA; 541 u64 mask = PERF_MEM_LOCK_NA;
542 542
543 if (self->mem_info) 543 if (he->mem_info)
544 mask = self->mem_info->data_src.mem_lock; 544 mask = he->mem_info->data_src.mem_lock;
545 545
546 if (mask & PERF_MEM_LOCK_NA) 546 if (mask & PERF_MEM_LOCK_NA)
547 out = "N/A"; 547 out = "N/A";
@@ -583,7 +583,7 @@ static const char * const tlb_access[] = {
583}; 583};
584#define NUM_TLB_ACCESS (sizeof(tlb_access)/sizeof(const char *)) 584#define NUM_TLB_ACCESS (sizeof(tlb_access)/sizeof(const char *))
585 585
586static int hist_entry__tlb_snprintf(struct hist_entry *self, char *bf, 586static int hist_entry__tlb_snprintf(struct hist_entry *he, char *bf,
587 size_t size, unsigned int width) 587 size_t size, unsigned int width)
588{ 588{
589 char out[64]; 589 char out[64];
@@ -594,8 +594,8 @@ static int hist_entry__tlb_snprintf(struct hist_entry *self, char *bf,
594 594
595 out[0] = '\0'; 595 out[0] = '\0';
596 596
597 if (self->mem_info) 597 if (he->mem_info)
598 m = self->mem_info->data_src.mem_dtlb; 598 m = he->mem_info->data_src.mem_dtlb;
599 599
600 hit = m & PERF_MEM_TLB_HIT; 600 hit = m & PERF_MEM_TLB_HIT;
601 miss = m & PERF_MEM_TLB_MISS; 601 miss = m & PERF_MEM_TLB_MISS;
@@ -660,7 +660,7 @@ static const char * const mem_lvl[] = {
660}; 660};
661#define NUM_MEM_LVL (sizeof(mem_lvl)/sizeof(const char *)) 661#define NUM_MEM_LVL (sizeof(mem_lvl)/sizeof(const char *))
662 662
663static int hist_entry__lvl_snprintf(struct hist_entry *self, char *bf, 663static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
664 size_t size, unsigned int width) 664 size_t size, unsigned int width)
665{ 665{
666 char out[64]; 666 char out[64];
@@ -669,8 +669,8 @@ static int hist_entry__lvl_snprintf(struct hist_entry *self, char *bf,
669 u64 m = PERF_MEM_LVL_NA; 669 u64 m = PERF_MEM_LVL_NA;
670 u64 hit, miss; 670 u64 hit, miss;
671 671
672 if (self->mem_info) 672 if (he->mem_info)
673 m = self->mem_info->data_src.mem_lvl; 673 m = he->mem_info->data_src.mem_lvl;
674 674
675 out[0] = '\0'; 675 out[0] = '\0';
676 676
@@ -728,7 +728,7 @@ static const char * const snoop_access[] = {
728}; 728};
729#define NUM_SNOOP_ACCESS (sizeof(snoop_access)/sizeof(const char *)) 729#define NUM_SNOOP_ACCESS (sizeof(snoop_access)/sizeof(const char *))
730 730
731static int hist_entry__snoop_snprintf(struct hist_entry *self, char *bf, 731static int hist_entry__snoop_snprintf(struct hist_entry *he, char *bf,
732 size_t size, unsigned int width) 732 size_t size, unsigned int width)
733{ 733{
734 char out[64]; 734 char out[64];
@@ -738,8 +738,8 @@ static int hist_entry__snoop_snprintf(struct hist_entry *self, char *bf,
738 738
739 out[0] = '\0'; 739 out[0] = '\0';
740 740
741 if (self->mem_info) 741 if (he->mem_info)
742 m = self->mem_info->data_src.mem_snoop; 742 m = he->mem_info->data_src.mem_snoop;
743 743
744 for (i = 0; m && i < NUM_SNOOP_ACCESS; i++, m >>= 1) { 744 for (i = 0; m && i < NUM_SNOOP_ACCESS; i++, m >>= 1) {
745 if (!(m & 0x1)) 745 if (!(m & 0x1))
@@ -776,10 +776,10 @@ sort__local_weight_cmp(struct hist_entry *left, struct hist_entry *right)
776 return he_weight(left) - he_weight(right); 776 return he_weight(left) - he_weight(right);
777} 777}
778 778
779static int hist_entry__local_weight_snprintf(struct hist_entry *self, char *bf, 779static int hist_entry__local_weight_snprintf(struct hist_entry *he, char *bf,
780 size_t size, unsigned int width) 780 size_t size, unsigned int width)
781{ 781{
782 return repsep_snprintf(bf, size, "%-*llu", width, he_weight(self)); 782 return repsep_snprintf(bf, size, "%-*llu", width, he_weight(he));
783} 783}
784 784
785struct sort_entry sort_local_weight = { 785struct sort_entry sort_local_weight = {
@@ -795,10 +795,10 @@ sort__global_weight_cmp(struct hist_entry *left, struct hist_entry *right)
795 return left->stat.weight - right->stat.weight; 795 return left->stat.weight - right->stat.weight;
796} 796}
797 797
798static int hist_entry__global_weight_snprintf(struct hist_entry *self, char *bf, 798static int hist_entry__global_weight_snprintf(struct hist_entry *he, char *bf,
799 size_t size, unsigned int width) 799 size_t size, unsigned int width)
800{ 800{
801 return repsep_snprintf(bf, size, "%-*llu", width, self->stat.weight); 801 return repsep_snprintf(bf, size, "%-*llu", width, he->stat.weight);
802} 802}
803 803
804struct sort_entry sort_global_weight = { 804struct sort_entry sort_global_weight = {
@@ -857,12 +857,12 @@ sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
857 right->branch_info->flags.abort; 857 right->branch_info->flags.abort;
858} 858}
859 859
860static int hist_entry__abort_snprintf(struct hist_entry *self, char *bf, 860static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
861 size_t size, unsigned int width) 861 size_t size, unsigned int width)
862{ 862{
863 static const char *out = "."; 863 static const char *out = ".";
864 864
865 if (self->branch_info->flags.abort) 865 if (he->branch_info->flags.abort)
866 out = "A"; 866 out = "A";
867 return repsep_snprintf(bf, size, "%-*s", width, out); 867 return repsep_snprintf(bf, size, "%-*s", width, out);
868} 868}
@@ -881,12 +881,12 @@ sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right)
881 right->branch_info->flags.in_tx; 881 right->branch_info->flags.in_tx;
882} 882}
883 883
884static int hist_entry__in_tx_snprintf(struct hist_entry *self, char *bf, 884static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf,
885 size_t size, unsigned int width) 885 size_t size, unsigned int width)
886{ 886{
887 static const char *out = "."; 887 static const char *out = ".";
888 888
889 if (self->branch_info->flags.in_tx) 889 if (he->branch_info->flags.in_tx)
890 out = "T"; 890 out = "T";
891 891
892 return repsep_snprintf(bf, size, "%-*s", width, out); 892 return repsep_snprintf(bf, size, "%-*s", width, out);
@@ -940,10 +940,10 @@ int hist_entry__transaction_len(void)
940 return len; 940 return len;
941} 941}
942 942
943static int hist_entry__transaction_snprintf(struct hist_entry *self, char *bf, 943static int hist_entry__transaction_snprintf(struct hist_entry *he, char *bf,
944 size_t size, unsigned int width) 944 size_t size, unsigned int width)
945{ 945{
946 u64 t = self->transaction; 946 u64 t = he->transaction;
947 char buf[128]; 947 char buf[128];
948 char *p = buf; 948 char *p = buf;
949 int i; 949 int i;
@@ -1125,7 +1125,7 @@ int setup_sorting(void)
1125 return ret; 1125 return ret;
1126} 1126}
1127 1127
1128static void sort_entry__setup_elide(struct sort_entry *self, 1128static void sort_entry__setup_elide(struct sort_entry *se,
1129 struct strlist *list, 1129 struct strlist *list,
1130 const char *list_name, FILE *fp) 1130 const char *list_name, FILE *fp)
1131{ 1131{
@@ -1133,7 +1133,7 @@ static void sort_entry__setup_elide(struct sort_entry *self,
1133 if (fp != NULL) 1133 if (fp != NULL)
1134 fprintf(fp, "# %s: %s\n", list_name, 1134 fprintf(fp, "# %s: %s\n", list_name,
1135 strlist__entry(list, 0)->s); 1135 strlist__entry(list, 0)->s);
1136 self->elide = true; 1136 se->elide = true;
1137 } 1137 }
1138} 1138}
1139 1139
diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c
index 834c8ebfe38e..67e4a0082822 100644
--- a/tools/perf/util/strfilter.c
+++ b/tools/perf/util/strfilter.c
@@ -10,22 +10,22 @@ static const char *OP_not = "!"; /* Logical NOT */
10#define is_operator(c) ((c) == '|' || (c) == '&' || (c) == '!') 10#define is_operator(c) ((c) == '|' || (c) == '&' || (c) == '!')
11#define is_separator(c) (is_operator(c) || (c) == '(' || (c) == ')') 11#define is_separator(c) (is_operator(c) || (c) == '(' || (c) == ')')
12 12
13static void strfilter_node__delete(struct strfilter_node *self) 13static void strfilter_node__delete(struct strfilter_node *node)
14{ 14{
15 if (self) { 15 if (node) {
16 if (self->p && !is_operator(*self->p)) 16 if (node->p && !is_operator(*node->p))
17 free((char *)self->p); 17 free((char *)node->p);
18 strfilter_node__delete(self->l); 18 strfilter_node__delete(node->l);
19 strfilter_node__delete(self->r); 19 strfilter_node__delete(node->r);
20 free(self); 20 free(node);
21 } 21 }
22} 22}
23 23
24void strfilter__delete(struct strfilter *self) 24void strfilter__delete(struct strfilter *filter)
25{ 25{
26 if (self) { 26 if (filter) {
27 strfilter_node__delete(self->root); 27 strfilter_node__delete(filter->root);
28 free(self); 28 free(filter);
29 } 29 }
30} 30}
31 31
@@ -170,30 +170,30 @@ struct strfilter *strfilter__new(const char *rules, const char **err)
170 return ret; 170 return ret;
171} 171}
172 172
173static bool strfilter_node__compare(struct strfilter_node *self, 173static bool strfilter_node__compare(struct strfilter_node *node,
174 const char *str) 174 const char *str)
175{ 175{
176 if (!self || !self->p) 176 if (!node || !node->p)
177 return false; 177 return false;
178 178
179 switch (*self->p) { 179 switch (*node->p) {
180 case '|': /* OR */ 180 case '|': /* OR */
181 return strfilter_node__compare(self->l, str) || 181 return strfilter_node__compare(node->l, str) ||
182 strfilter_node__compare(self->r, str); 182 strfilter_node__compare(node->r, str);
183 case '&': /* AND */ 183 case '&': /* AND */
184 return strfilter_node__compare(self->l, str) && 184 return strfilter_node__compare(node->l, str) &&
185 strfilter_node__compare(self->r, str); 185 strfilter_node__compare(node->r, str);
186 case '!': /* NOT */ 186 case '!': /* NOT */
187 return !strfilter_node__compare(self->r, str); 187 return !strfilter_node__compare(node->r, str);
188 default: 188 default:
189 return strglobmatch(str, self->p); 189 return strglobmatch(str, node->p);
190 } 190 }
191} 191}
192 192
193/* Return true if STR matches the filter rules */ 193/* Return true if STR matches the filter rules */
194bool strfilter__compare(struct strfilter *self, const char *str) 194bool strfilter__compare(struct strfilter *node, const char *str)
195{ 195{
196 if (!self) 196 if (!node)
197 return false; 197 return false;
198 return strfilter_node__compare(self->root, str); 198 return strfilter_node__compare(node->root, str);
199} 199}
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index e3d4a550a703..80d19a086072 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -9,51 +9,51 @@
9 9
10struct thread *thread__new(pid_t pid, pid_t tid) 10struct thread *thread__new(pid_t pid, pid_t tid)
11{ 11{
12 struct thread *self = zalloc(sizeof(*self)); 12 struct thread *thread = zalloc(sizeof(*thread));
13 13
14 if (self != NULL) { 14 if (thread != NULL) {
15 map_groups__init(&self->mg); 15 map_groups__init(&thread->mg);
16 self->pid_ = pid; 16 thread->pid_ = pid;
17 self->tid = tid; 17 thread->tid = tid;
18 self->ppid = -1; 18 thread->ppid = -1;
19 self->comm = malloc(32); 19 thread->comm = malloc(32);
20 if (self->comm) 20 if (thread->comm)
21 snprintf(self->comm, 32, ":%d", self->tid); 21 snprintf(thread->comm, 32, ":%d", thread->tid);
22 } 22 }
23 23
24 return self; 24 return thread;
25} 25}
26 26
27void thread__delete(struct thread *self) 27void thread__delete(struct thread *thread)
28{ 28{
29 map_groups__exit(&self->mg); 29 map_groups__exit(&thread->mg);
30 free(self->comm); 30 free(thread->comm);
31 free(self); 31 free(thread);
32} 32}
33 33
34int thread__set_comm(struct thread *self, const char *comm) 34int thread__set_comm(struct thread *thread, const char *comm)
35{ 35{
36 int err; 36 int err;
37 37
38 if (self->comm) 38 if (thread->comm)
39 free(self->comm); 39 free(thread->comm);
40 self->comm = strdup(comm); 40 thread->comm = strdup(comm);
41 err = self->comm == NULL ? -ENOMEM : 0; 41 err = thread->comm == NULL ? -ENOMEM : 0;
42 if (!err) { 42 if (!err) {
43 self->comm_set = true; 43 thread->comm_set = true;
44 } 44 }
45 return err; 45 return err;
46} 46}
47 47
48int thread__comm_len(struct thread *self) 48int thread__comm_len(struct thread *thread)
49{ 49{
50 if (!self->comm_len) { 50 if (!thread->comm_len) {
51 if (!self->comm) 51 if (!thread->comm)
52 return 0; 52 return 0;
53 self->comm_len = strlen(self->comm); 53 thread->comm_len = strlen(thread->comm);
54 } 54 }
55 55
56 return self->comm_len; 56 return thread->comm_len;
57} 57}
58 58
59size_t thread__fprintf(struct thread *thread, FILE *fp) 59size_t thread__fprintf(struct thread *thread, FILE *fp)
@@ -62,30 +62,30 @@ size_t thread__fprintf(struct thread *thread, FILE *fp)
62 map_groups__fprintf(&thread->mg, verbose, fp); 62 map_groups__fprintf(&thread->mg, verbose, fp);
63} 63}
64 64
65void thread__insert_map(struct thread *self, struct map *map) 65void thread__insert_map(struct thread *thread, struct map *map)
66{ 66{
67 map_groups__fixup_overlappings(&self->mg, map, verbose, stderr); 67 map_groups__fixup_overlappings(&thread->mg, map, verbose, stderr);
68 map_groups__insert(&self->mg, map); 68 map_groups__insert(&thread->mg, map);
69} 69}
70 70
71int thread__fork(struct thread *self, struct thread *parent) 71int thread__fork(struct thread *thread, struct thread *parent)
72{ 72{
73 int i; 73 int i;
74 74
75 if (parent->comm_set) { 75 if (parent->comm_set) {
76 if (self->comm) 76 if (thread->comm)
77 free(self->comm); 77 free(thread->comm);
78 self->comm = strdup(parent->comm); 78 thread->comm = strdup(parent->comm);
79 if (!self->comm) 79 if (!thread->comm)
80 return -ENOMEM; 80 return -ENOMEM;
81 self->comm_set = true; 81 thread->comm_set = true;
82 } 82 }
83 83
84 for (i = 0; i < MAP__NR_TYPES; ++i) 84 for (i = 0; i < MAP__NR_TYPES; ++i)
85 if (map_groups__clone(&self->mg, &parent->mg, i) < 0) 85 if (map_groups__clone(&thread->mg, &parent->mg, i) < 0)
86 return -ENOMEM; 86 return -ENOMEM;
87 87
88 self->ppid = parent->tid; 88 thread->ppid = parent->tid;
89 89
90 return 0; 90 return 0;
91} 91}