diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-diff.c | 3 | ||||
| -rw-r--r-- | tools/perf/builtin-report.c | 16 | ||||
| -rw-r--r-- | tools/perf/builtin-top.c | 5 | ||||
| -rw-r--r-- | tools/perf/tests/hists_link.c | 6 | ||||
| -rw-r--r-- | tools/perf/util/hist.c | 75 | ||||
| -rw-r--r-- | tools/perf/util/hist.h | 18 |
7 files changed, 30 insertions, 95 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 6c5ae57831f6..4087ab19823c 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
| @@ -65,7 +65,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
| 65 | return 0; | 65 | return 0; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | he = __hists__add_entry(&evsel->hists, al, NULL, 1, 1, 0); | 68 | he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0); |
| 69 | if (he == NULL) | 69 | if (he == NULL) |
| 70 | return -ENOMEM; | 70 | return -ENOMEM; |
| 71 | 71 | ||
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index b605009e803f..3b67ea2444bd 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
| @@ -307,7 +307,8 @@ static 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(hists, al, NULL, period, weight, transaction) != NULL) | 310 | if (__hists__add_entry(hists, al, NULL, NULL, NULL, period, weight, |
| 311 | transaction) != NULL) | ||
| 311 | return 0; | 312 | return 0; |
| 312 | return -ENOMEM; | 313 | return -ENOMEM; |
| 313 | } | 314 | } |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 25f83d5d66fd..8cf8e66ba594 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -115,7 +115,8 @@ static int perf_report__add_mem_hist_entry(struct perf_tool *tool, | |||
| 115 | * and this is indirectly achieved by passing period=weight here | 115 | * and this is indirectly achieved by passing period=weight here |
| 116 | * and the he_stat__add_period() function. | 116 | * and the he_stat__add_period() function. |
| 117 | */ | 117 | */ |
| 118 | he = __hists__add_mem_entry(&evsel->hists, al, parent, mi, cost, cost); | 118 | he = __hists__add_entry(&evsel->hists, al, parent, NULL, mi, |
| 119 | cost, cost, 0); | ||
| 119 | if (!he) | 120 | if (!he) |
| 120 | return -ENOMEM; | 121 | return -ENOMEM; |
| 121 | 122 | ||
| @@ -200,12 +201,16 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool, | |||
| 200 | 201 | ||
| 201 | err = -ENOMEM; | 202 | err = -ENOMEM; |
| 202 | 203 | ||
| 204 | /* overwrite the 'al' to branch-to info */ | ||
| 205 | al->map = bi[i].to.map; | ||
| 206 | al->sym = bi[i].to.sym; | ||
| 207 | al->addr = bi[i].to.addr; | ||
| 203 | /* | 208 | /* |
| 204 | * The report shows the percentage of total branches captured | 209 | * The report shows the percentage of total branches captured |
| 205 | * and not events sampled. Thus we use a pseudo period of 1. | 210 | * and not events sampled. Thus we use a pseudo period of 1. |
| 206 | */ | 211 | */ |
| 207 | he = __hists__add_branch_entry(&evsel->hists, al, parent, | 212 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, |
| 208 | &bi[i], 1, 1); | 213 | 1, 1, 0); |
| 209 | if (he) { | 214 | if (he) { |
| 210 | struct annotation *notes; | 215 | struct annotation *notes; |
| 211 | bx = he->branch_info; | 216 | bx = he->branch_info; |
| @@ -266,8 +271,9 @@ static int perf_evsel__add_hist_entry(struct perf_tool *tool, | |||
| 266 | return err; | 271 | return err; |
| 267 | } | 272 | } |
| 268 | 273 | ||
| 269 | he = __hists__add_entry(&evsel->hists, al, parent, sample->period, | 274 | he = __hists__add_entry(&evsel->hists, al, parent, NULL, NULL, |
| 270 | sample->weight, sample->transaction); | 275 | sample->period, sample->weight, |
| 276 | sample->transaction); | ||
| 271 | if (he == NULL) | 277 | if (he == NULL) |
| 272 | return -ENOMEM; | 278 | return -ENOMEM; |
| 273 | 279 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index ca5ca37980fb..21897f0ffcd3 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
| @@ -246,8 +246,9 @@ static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel, | |||
| 246 | struct hist_entry *he; | 246 | struct hist_entry *he; |
| 247 | 247 | ||
| 248 | pthread_mutex_lock(&evsel->hists.lock); | 248 | pthread_mutex_lock(&evsel->hists.lock); |
| 249 | he = __hists__add_entry(&evsel->hists, al, NULL, sample->period, | 249 | he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, |
| 250 | sample->weight, sample->transaction); | 250 | sample->period, sample->weight, |
| 251 | sample->transaction); | ||
| 251 | pthread_mutex_unlock(&evsel->hists.lock); | 252 | pthread_mutex_unlock(&evsel->hists.lock); |
| 252 | if (he == NULL) | 253 | if (he == NULL) |
| 253 | return NULL; | 254 | return NULL; |
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 6c337e653540..173bf42cc03e 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
| @@ -223,7 +223,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
| 223 | goto out; | 223 | goto out; |
| 224 | 224 | ||
| 225 | he = __hists__add_entry(&evsel->hists, &al, NULL, | 225 | he = __hists__add_entry(&evsel->hists, &al, NULL, |
| 226 | 1, 1, 0); | 226 | NULL, NULL, 1, 1, 0); |
| 227 | if (he == NULL) | 227 | if (he == NULL) |
| 228 | goto out; | 228 | goto out; |
| 229 | 229 | ||
| @@ -245,8 +245,8 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
| 245 | &sample) < 0) | 245 | &sample) < 0) |
| 246 | goto out; | 246 | goto out; |
| 247 | 247 | ||
| 248 | he = __hists__add_entry(&evsel->hists, &al, NULL, 1, 1, | 248 | he = __hists__add_entry(&evsel->hists, &al, NULL, |
| 249 | 0); | 249 | NULL, NULL, 1, 1, 0); |
| 250 | if (he == NULL) | 250 | if (he == NULL) |
| 251 | goto out; | 251 | goto out; |
| 252 | 252 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 30793f98c8bb..822903eaa201 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -407,73 +407,12 @@ out: | |||
| 407 | return he; | 407 | return he; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | struct hist_entry *__hists__add_mem_entry(struct hists *hists, | ||
| 411 | struct addr_location *al, | ||
| 412 | struct symbol *sym_parent, | ||
| 413 | struct mem_info *mi, | ||
| 414 | u64 period, | ||
| 415 | u64 weight) | ||
| 416 | { | ||
| 417 | struct hist_entry entry = { | ||
| 418 | .thread = al->thread, | ||
| 419 | .comm = thread__comm(al->thread), | ||
| 420 | .ms = { | ||
| 421 | .map = al->map, | ||
| 422 | .sym = al->sym, | ||
| 423 | }, | ||
| 424 | .stat = { | ||
| 425 | .period = period, | ||
| 426 | .weight = weight, | ||
| 427 | .nr_events = 1, | ||
| 428 | }, | ||
| 429 | .cpu = al->cpu, | ||
| 430 | .ip = al->addr, | ||
| 431 | .level = al->level, | ||
| 432 | .parent = sym_parent, | ||
| 433 | .filtered = symbol__parent_filter(sym_parent), | ||
| 434 | .hists = hists, | ||
| 435 | .mem_info = mi, | ||
| 436 | .branch_info = NULL, | ||
| 437 | }; | ||
| 438 | return add_hist_entry(hists, &entry, al, period, weight); | ||
| 439 | } | ||
| 440 | |||
| 441 | struct hist_entry *__hists__add_branch_entry(struct hists *hists, | ||
| 442 | struct addr_location *al, | ||
| 443 | struct symbol *sym_parent, | ||
| 444 | struct branch_info *bi, | ||
| 445 | u64 period, | ||
| 446 | u64 weight) | ||
| 447 | { | ||
| 448 | struct hist_entry entry = { | ||
| 449 | .thread = al->thread, | ||
| 450 | .comm = thread__comm(al->thread), | ||
| 451 | .ms = { | ||
| 452 | .map = bi->to.map, | ||
| 453 | .sym = bi->to.sym, | ||
| 454 | }, | ||
| 455 | .cpu = al->cpu, | ||
| 456 | .ip = bi->to.addr, | ||
| 457 | .level = al->level, | ||
| 458 | .stat = { | ||
| 459 | .period = period, | ||
| 460 | .nr_events = 1, | ||
| 461 | .weight = weight, | ||
| 462 | }, | ||
| 463 | .parent = sym_parent, | ||
| 464 | .filtered = symbol__parent_filter(sym_parent), | ||
| 465 | .branch_info = bi, | ||
| 466 | .hists = hists, | ||
| 467 | .mem_info = NULL, | ||
| 468 | }; | ||
| 469 | |||
| 470 | return add_hist_entry(hists, &entry, al, period, weight); | ||
| 471 | } | ||
| 472 | |||
| 473 | struct hist_entry *__hists__add_entry(struct hists *hists, | 410 | struct hist_entry *__hists__add_entry(struct hists *hists, |
| 474 | struct addr_location *al, | 411 | struct addr_location *al, |
| 475 | struct symbol *sym_parent, u64 period, | 412 | struct symbol *sym_parent, |
| 476 | u64 weight, u64 transaction) | 413 | struct branch_info *bi, |
| 414 | struct mem_info *mi, | ||
| 415 | u64 period, u64 weight, u64 transaction) | ||
| 477 | { | 416 | { |
| 478 | struct hist_entry entry = { | 417 | struct hist_entry entry = { |
| 479 | .thread = al->thread, | 418 | .thread = al->thread, |
| @@ -486,15 +425,15 @@ struct hist_entry *__hists__add_entry(struct hists *hists, | |||
| 486 | .ip = al->addr, | 425 | .ip = al->addr, |
| 487 | .level = al->level, | 426 | .level = al->level, |
| 488 | .stat = { | 427 | .stat = { |
| 489 | .period = period, | ||
| 490 | .nr_events = 1, | 428 | .nr_events = 1, |
| 429 | .period = period, | ||
| 491 | .weight = weight, | 430 | .weight = weight, |
| 492 | }, | 431 | }, |
| 493 | .parent = sym_parent, | 432 | .parent = sym_parent, |
| 494 | .filtered = symbol__parent_filter(sym_parent), | 433 | .filtered = symbol__parent_filter(sym_parent), |
| 495 | .hists = hists, | 434 | .hists = hists, |
| 496 | .branch_info = NULL, | 435 | .branch_info = bi, |
| 497 | .mem_info = NULL, | 436 | .mem_info = mi, |
| 498 | .transaction = transaction, | 437 | .transaction = transaction, |
| 499 | }; | 438 | }; |
| 500 | 439 | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 9d2d022cdb79..307f1c742563 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
| @@ -86,7 +86,9 @@ struct hists { | |||
| 86 | 86 | ||
| 87 | struct hist_entry *__hists__add_entry(struct hists *self, | 87 | struct hist_entry *__hists__add_entry(struct hists *self, |
| 88 | struct addr_location *al, | 88 | struct addr_location *al, |
| 89 | struct symbol *parent, u64 period, | 89 | struct symbol *parent, |
| 90 | struct branch_info *bi, | ||
| 91 | struct mem_info *mi, u64 period, | ||
| 90 | u64 weight, u64 transaction); | 92 | u64 weight, u64 transaction); |
| 91 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); | 93 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); |
| 92 | int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); | 94 | int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); |
| @@ -95,20 +97,6 @@ int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size, | |||
| 95 | struct hists *hists); | 97 | struct hists *hists); |
| 96 | void hist_entry__free(struct hist_entry *); | 98 | void hist_entry__free(struct hist_entry *); |
| 97 | 99 | ||
| 98 | struct hist_entry *__hists__add_branch_entry(struct hists *self, | ||
| 99 | struct addr_location *al, | ||
| 100 | struct symbol *sym_parent, | ||
| 101 | struct branch_info *bi, | ||
| 102 | u64 period, | ||
| 103 | u64 weight); | ||
| 104 | |||
| 105 | struct hist_entry *__hists__add_mem_entry(struct hists *self, | ||
| 106 | struct addr_location *al, | ||
| 107 | struct symbol *sym_parent, | ||
| 108 | struct mem_info *mi, | ||
| 109 | u64 period, | ||
| 110 | u64 weight); | ||
| 111 | |||
| 112 | void hists__output_resort(struct hists *self); | 100 | void hists__output_resort(struct hists *self); |
| 113 | void hists__collapse_resort(struct hists *self, struct ui_progress *prog); | 101 | void hists__collapse_resort(struct hists *self, struct ui_progress *prog); |
| 114 | 102 | ||
