aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c95
1 files changed, 23 insertions, 72 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 9ff6cf3e9a99..822903eaa201 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -160,6 +160,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
160 hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3); 160 hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3);
161 hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); 161 hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12);
162 hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); 162 hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12);
163
164 if (h->transaction)
165 hists__new_col_len(hists, HISTC_TRANSACTION,
166 hist_entry__transaction_len());
163} 167}
164 168
165void hists__output_recalc_col_len(struct hists *hists, int max_rows) 169void hists__output_recalc_col_len(struct hists *hists, int max_rows)
@@ -346,7 +350,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
346 struct rb_node **p; 350 struct rb_node **p;
347 struct rb_node *parent = NULL; 351 struct rb_node *parent = NULL;
348 struct hist_entry *he; 352 struct hist_entry *he;
349 int cmp; 353 int64_t cmp;
350 354
351 p = &hists->entries_in->rb_node; 355 p = &hists->entries_in->rb_node;
352 356
@@ -395,6 +399,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
395 if (!he) 399 if (!he)
396 return NULL; 400 return NULL;
397 401
402 hists->nr_entries++;
398 rb_link_node(&he->rb_node_in, parent, p); 403 rb_link_node(&he->rb_node_in, parent, p);
399 rb_insert_color(&he->rb_node_in, hists->entries_in); 404 rb_insert_color(&he->rb_node_in, hists->entries_in);
400out: 405out:
@@ -402,74 +407,16 @@ out:
402 return he; 407 return he;
403} 408}
404 409
405struct hist_entry *__hists__add_mem_entry(struct hists *self, 410struct hist_entry *__hists__add_entry(struct hists *hists,
406 struct addr_location *al,
407 struct symbol *sym_parent,
408 struct mem_info *mi,
409 u64 period,
410 u64 weight)
411{
412 struct hist_entry entry = {
413 .thread = al->thread,
414 .ms = {
415 .map = al->map,
416 .sym = al->sym,
417 },
418 .stat = {
419 .period = period,
420 .weight = weight,
421 .nr_events = 1,
422 },
423 .cpu = al->cpu,
424 .ip = al->addr,
425 .level = al->level,
426 .parent = sym_parent,
427 .filtered = symbol__parent_filter(sym_parent),
428 .hists = self,
429 .mem_info = mi,
430 .branch_info = NULL,
431 };
432 return add_hist_entry(self, &entry, al, period, weight);
433}
434
435struct hist_entry *__hists__add_branch_entry(struct hists *self,
436 struct addr_location *al,
437 struct symbol *sym_parent,
438 struct branch_info *bi,
439 u64 period,
440 u64 weight)
441{
442 struct hist_entry entry = {
443 .thread = al->thread,
444 .ms = {
445 .map = bi->to.map,
446 .sym = bi->to.sym,
447 },
448 .cpu = al->cpu,
449 .ip = bi->to.addr,
450 .level = al->level,
451 .stat = {
452 .period = period,
453 .nr_events = 1,
454 .weight = weight,
455 },
456 .parent = sym_parent,
457 .filtered = symbol__parent_filter(sym_parent),
458 .branch_info = bi,
459 .hists = self,
460 .mem_info = NULL,
461 };
462
463 return add_hist_entry(self, &entry, al, period, weight);
464}
465
466struct hist_entry *__hists__add_entry(struct hists *self,
467 struct addr_location *al, 411 struct addr_location *al,
468 struct symbol *sym_parent, u64 period, 412 struct symbol *sym_parent,
469 u64 weight) 413 struct branch_info *bi,
414 struct mem_info *mi,
415 u64 period, u64 weight, u64 transaction)
470{ 416{
471 struct hist_entry entry = { 417 struct hist_entry entry = {
472 .thread = al->thread, 418 .thread = al->thread,
419 .comm = thread__comm(al->thread),
473 .ms = { 420 .ms = {
474 .map = al->map, 421 .map = al->map,
475 .sym = al->sym, 422 .sym = al->sym,
@@ -478,18 +425,19 @@ struct hist_entry *__hists__add_entry(struct hists *self,
478 .ip = al->addr, 425 .ip = al->addr,
479 .level = al->level, 426 .level = al->level,
480 .stat = { 427 .stat = {
481 .period = period,
482 .nr_events = 1, 428 .nr_events = 1,
429 .period = period,
483 .weight = weight, 430 .weight = weight,
484 }, 431 },
485 .parent = sym_parent, 432 .parent = sym_parent,
486 .filtered = symbol__parent_filter(sym_parent), 433 .filtered = symbol__parent_filter(sym_parent),
487 .hists = self, 434 .hists = hists,
488 .branch_info = NULL, 435 .branch_info = bi,
489 .mem_info = NULL, 436 .mem_info = mi,
437 .transaction = transaction,
490 }; 438 };
491 439
492 return add_hist_entry(self, &entry, al, period, weight); 440 return add_hist_entry(hists, &entry, al, period, weight);
493} 441}
494 442
495int64_t 443int64_t
@@ -530,6 +478,7 @@ void hist_entry__free(struct hist_entry *he)
530{ 478{
531 free(he->branch_info); 479 free(he->branch_info);
532 free(he->mem_info); 480 free(he->mem_info);
481 free_srcline(he->srcline);
533 free(he); 482 free(he);
534} 483}
535 484
@@ -598,7 +547,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
598 hists__filter_entry_by_symbol(hists, he); 547 hists__filter_entry_by_symbol(hists, he);
599} 548}
600 549
601void hists__collapse_resort(struct hists *hists) 550void hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
602{ 551{
603 struct rb_root *root; 552 struct rb_root *root;
604 struct rb_node *next; 553 struct rb_node *next;
@@ -625,6 +574,8 @@ void hists__collapse_resort(struct hists *hists)
625 */ 574 */
626 hists__apply_filters(hists, n); 575 hists__apply_filters(hists, n);
627 } 576 }
577 if (prog)
578 ui_progress__update(prog, 1);
628 } 579 }
629} 580}
630 581
@@ -884,7 +835,7 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
884 struct rb_node **p; 835 struct rb_node **p;
885 struct rb_node *parent = NULL; 836 struct rb_node *parent = NULL;
886 struct hist_entry *he; 837 struct hist_entry *he;
887 int cmp; 838 int64_t cmp;
888 839
889 if (sort__need_collapse) 840 if (sort__need_collapse)
890 root = &hists->entries_collapsed; 841 root = &hists->entries_collapsed;