~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to tools/perf/util/hist.c

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
        hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3);
161
161
        hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12);
162
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
 
165
169
void hists__output_recalc_col_len(struct hists *hists, int max_rows)
346
350
        struct rb_node **p;
347
351
        struct rb_node *parent = NULL;
348
352
        struct hist_entry *he;
349
 
        int cmp;
 
353
        int64_t cmp;
350
354
 
351
355
        p = &hists->entries_in->rb_node;
352
356
 
395
399
        if (!he)
396
400
                return NULL;
397
401
 
 
402
        hists->nr_entries++;
398
403
        rb_link_node(&he->rb_node_in, parent, p);
399
404
        rb_insert_color(&he->rb_node_in, hists->entries_in);
400
405
out:
402
407
        return he;
403
408
}
404
409
 
405
 
struct hist_entry *__hists__add_mem_entry(struct hists *self,
406
 
                                          struct addr_location *al,
407
 
                                          struct symbol *sym_parent,
408
 
                                          struct mem_info *mi,
409
 
                                          u64 period,
410
 
                                          u64 weight)
 
410
struct hist_entry *__hists__add_entry(struct hists *hists,
 
411
                                      struct addr_location *al,
 
412
                                      struct symbol *sym_parent,
 
413
                                      struct branch_info *bi,
 
414
                                      struct mem_info *mi,
 
415
                                      u64 period, u64 weight, u64 transaction)
411
416
{
412
417
        struct hist_entry entry = {
413
418
                .thread = al->thread,
 
419
                .comm = thread__comm(al->thread),
414
420
                .ms = {
415
421
                        .map    = al->map,
416
422
                        .sym    = al->sym,
417
423
                },
 
424
                .cpu    = al->cpu,
 
425
                .ip     = al->addr,
 
426
                .level  = al->level,
418
427
                .stat = {
 
428
                        .nr_events = 1,
419
429
                        .period = period,
420
430
                        .weight = weight,
421
 
                        .nr_events = 1,
422
431
                },
423
 
                .cpu    = al->cpu,
424
 
                .ip     = al->addr,
425
 
                .level  = al->level,
426
432
                .parent = sym_parent,
427
433
                .filtered = symbol__parent_filter(sym_parent),
428
 
                .hists = self,
 
434
                .hists  = hists,
 
435
                .branch_info = bi,
429
436
                .mem_info = mi,
430
 
                .branch_info = NULL,
431
 
        };
432
 
        return add_hist_entry(self, &entry, al, period, weight);
433
 
}
434
 
 
435
 
struct 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
 
 
466
 
struct hist_entry *__hists__add_entry(struct hists *self,
467
 
                                      struct addr_location *al,
468
 
                                      struct symbol *sym_parent, u64 period,
469
 
                                      u64 weight)
470
 
{
471
 
        struct hist_entry entry = {
472
 
                .thread = al->thread,
473
 
                .ms = {
474
 
                        .map    = al->map,
475
 
                        .sym    = al->sym,
476
 
                },
477
 
                .cpu    = al->cpu,
478
 
                .ip     = al->addr,
479
 
                .level  = al->level,
480
 
                .stat = {
481
 
                        .period = period,
482
 
                        .nr_events = 1,
483
 
                        .weight = weight,
484
 
                },
485
 
                .parent = sym_parent,
486
 
                .filtered = symbol__parent_filter(sym_parent),
487
 
                .hists  = self,
488
 
                .branch_info = NULL,
489
 
                .mem_info = NULL,
490
 
        };
491
 
 
492
 
        return add_hist_entry(self, &entry, al, period, weight);
 
437
                .transaction = transaction,
 
438
        };
 
439
 
 
440
        return add_hist_entry(hists, &entry, al, period, weight);
493
441
}
494
442
 
495
443
int64_t
530
478
{
531
479
        free(he->branch_info);
532
480
        free(he->mem_info);
 
481
        free_srcline(he->srcline);
533
482
        free(he);
534
483
}
535
484
 
598
547
        hists__filter_entry_by_symbol(hists, he);
599
548
}
600
549
 
601
 
void hists__collapse_resort(struct hists *hists)
 
550
void hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
602
551
{
603
552
        struct rb_root *root;
604
553
        struct rb_node *next;
625
574
                         */
626
575
                        hists__apply_filters(hists, n);
627
576
                }
 
577
                if (prog)
 
578
                        ui_progress__update(prog, 1);
628
579
        }
629
580
}
630
581
 
884
835
        struct rb_node **p;
885
836
        struct rb_node *parent = NULL;
886
837
        struct hist_entry *he;
887
 
        int cmp;
 
838
        int64_t cmp;
888
839
 
889
840
        if (sort__need_collapse)
890
841
                root = &hists->entries_collapsed;