Lines Matching refs:notes

6  * copyright notes.
809 struct annotation *notes = symbol__annotation(sym);
812 notes->src->cycles_hist = calloc(size, sizeof(struct cyc_hist));
813 if (notes->src->cycles_hist == NULL)
820 struct annotation *notes = symbol__annotation(sym);
822 pthread_mutex_lock(&notes->lock);
823 if (notes->src != NULL) {
824 memset(notes->src->histograms, 0,
825 notes->src->nr_histograms * notes->src->sizeof_sym_hist);
826 if (notes->src->cycles_hist)
827 memset(notes->src->cycles_hist, 0,
830 pthread_mutex_unlock(&notes->lock);
921 struct annotation *notes = symbol__annotation(sym);
923 if (notes->src == NULL) {
924 notes->src = annotated_source__new();
925 if (notes->src == NULL)
930 if (!notes->src->cycles_hist) {
935 return notes->src->cycles_hist;
940 struct annotation *notes = symbol__annotation(sym);
942 if (notes->src == NULL) {
943 notes->src = annotated_source__new();
944 if (notes->src == NULL)
949 if (notes->src->histograms == NULL) {
951 annotated_source__alloc_histograms(notes->src, symbol__size(sym),
955 return notes->src;
1032 static unsigned annotation__count_insn(struct annotation *notes, u64 start, u64 end)
1038 if (notes->offsets[offset])
1044 static void annotation__count_and_fill(struct annotation *notes, u64 start, u64 end, struct cyc_hist *ch)
1050 n_insn = annotation__count_insn(notes, start, end);
1059 struct annotation_line *al = notes->offsets[offset];
1068 notes->hit_cycles += ch->cycles;
1069 notes->hit_insn += n_insn * ch->num;
1070 notes->cover_insn += cover_insn;
1075 void annotation__compute_ipc(struct annotation *notes, size_t size)
1079 if (!notes->src || !notes->src->cycles_hist)
1082 notes->total_insn = annotation__count_insn(notes, 0, size - 1);
1083 notes->hit_cycles = 0;
1084 notes->hit_insn = 0;
1085 notes->cover_insn = 0;
1087 pthread_mutex_lock(&notes->lock);
1091 ch = &notes->src->cycles_hist[offset];
1096 annotation__count_and_fill(notes, ch->start, offset, ch);
1097 al = notes->offsets[offset];
1103 notes->have_cycles = true;
1106 pthread_mutex_unlock(&notes->lock);
1379 struct annotation *notes = symbol__annotation(sym);
1401 list_for_each_entry_from(queue, &notes->src->source, node) {
1492 struct annotation *notes = symbol__annotation(sym);
1546 annotation_line__add(&dl->al, &notes->src->source);
1558 struct annotation *notes = symbol__annotation(sym);
1559 struct list_head *list = &notes->src->source;
1699 struct annotation *notes = symbol__annotation(sym);
1818 &notes->src->source);
1828 annotation_line__add(&dl->al, &notes->src->source);
1853 struct annotation *notes = symbol__annotation(sym);
1861 annotation_line__add(&dl->al, &notes->src->source);
2137 static void annotation__calc_percent(struct annotation *notes,
2143 list_for_each_entry(al, &notes->src->source, node) {
2150 next = annotation_line__next(al, &notes->src->source);
2160 sym_hist = annotation__histogram(notes, evsel->idx);
2170 struct annotation *notes = symbol__annotation(sym);
2172 annotation__calc_percent(notes, evsel, symbol__size(sym));
2179 struct annotation *notes = symbol__annotation(sym);
2210 notes->start = map__rip_2objdump(ms->map, sym->start);
2342 struct annotation *notes = symbol__annotation(sym);
2343 struct sym_hist *h = annotation__histogram(notes, evsel->idx);
2375 struct annotation *notes = symbol__annotation(sym);
2376 struct sym_hist *h = annotation__histogram(notes, evsel->idx);
2417 addr_fmt_width = annotated_source__addr_fmt_width(&notes->src->source, start);
2419 list_for_each_entry(pos, &notes->src->source, node) {
2509 struct annotation *notes = symbol__annotation(sym);
2521 list_for_each_entry(al, &notes->src->source, node) {
2522 if (annotation_line__filter(al, notes))
2524 annotation_line__write(al, notes, &wops, opts);
2566 struct annotation *notes = symbol__annotation(sym);
2567 struct sym_hist *h = annotation__histogram(notes, evidx);
2569 memset(h, 0, notes->src->sizeof_sym_hist);
2574 struct annotation *notes = symbol__annotation(sym);
2575 struct sym_hist *h = annotation__histogram(notes, evidx);
2633 void annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym)
2642 struct annotation_line *al = notes->offsets[offset];
2650 al = notes->offsets[dl->ops.target.offset];
2659 if (++al->jump_sources > notes->max_jump_sources)
2660 notes->max_jump_sources = al->jump_sources;
2664 void annotation__set_offsets(struct annotation *notes, s64 size)
2668 notes->max_line_len = 0;
2669 notes->nr_entries = 0;
2670 notes->nr_asm_entries = 0;
2672 list_for_each_entry(al, &notes->src->source, node) {
2675 if (notes->max_line_len < line_len)
2676 notes->max_line_len = line_len;
2677 al->idx = notes->nr_entries++;
2679 al->idx_asm = notes->nr_asm_entries++;
2688 notes->offsets[al->offset] = al;
2703 static int annotation__max_ins_name(struct annotation *notes)
2708 list_for_each_entry(al, &notes->src->source, node) {
2720 void annotation__init_column_widths(struct annotation *notes, struct symbol *sym)
2722 notes->widths.addr = notes->widths.target =
2723 notes->widths.min_addr = hex_width(symbol__size(sym));
2724 notes->widths.max_addr = hex_width(sym->end);
2725 notes->widths.jumps = width_jumps(notes->max_jump_sources);
2726 notes->widths.max_ins_name = annotation__max_ins_name(notes);
2729 void annotation__update_column_widths(struct annotation *notes)
2731 if (notes->options->use_offset)
2732 notes->widths.target = notes->widths.min_addr;
2734 notes->widths.target = notes->widths.max_addr;
2736 notes->widths.addr = notes->widths.target;
2738 if (notes->options->show_nr_jumps)
2739 notes->widths.addr += notes->widths.jumps + 1;
2742 static void annotation__calc_lines(struct annotation *notes, struct map *map,
2749 list_for_each_entry(al, &notes->src->source, node) {
2766 al->path = get_srcline(map->dso, notes->start + al->offset, NULL,
2767 false, true, notes->start + al->offset);
2777 struct annotation *notes = symbol__annotation(ms->sym);
2779 annotation__calc_lines(notes, ms->map, root, opts);
2842 struct annotation *notes,
2848 for (i = 0; i < notes->nr_events; i++) {
2861 static void disasm_line__write(struct disasm_line *dl, struct annotation *notes,
2889 disasm_line__scnprintf(dl, bf, size, !notes->options->use_offset, notes->widths.max_ins_name);
2892 static void ipc_coverage_string(char *bf, int size, struct annotation *notes)
2896 if (notes->hit_cycles)
2897 ipc = notes->hit_insn / ((double)notes->hit_cycles);
2899 if (notes->total_insn) {
2900 coverage = notes->cover_insn * 100.0 /
2901 ((double)notes->total_insn);
2908 static void __annotation_line__write(struct annotation_line *al, struct annotation *notes,
2918 double percent_max = annotation_line__max_percent(al, notes, percent_type);
2919 int pcnt_width = annotation__pcnt_width(notes),
2920 cycles_width = annotation__cycles_width(notes);
2926 if (notes->have_cycles) {
2936 for (i = 0; i < notes->nr_events; i++) {
2963 if (notes->have_cycles) {
2971 if (!notes->options->show_minmax_cycle) {
3005 ipc_coverage_string(bf, sizeof(bf), notes);
3015 if (al->line_nr && notes->options->show_linenr)
3016 printed = scnprintf(bf, sizeof(bf), "%-*d ", notes->widths.addr + 1, al->line_nr);
3018 printed = scnprintf(bf, sizeof(bf), "%-*s ", notes->widths.addr, " ");
3025 if (!notes->options->use_offset)
3026 addr += notes->start;
3028 if (!notes->options->use_offset) {
3032 notes->options->offset_level >= ANNOTATION__OFFSET_JUMP_TARGETS) {
3033 if (notes->options->show_nr_jumps) {
3036 notes->widths.jumps,
3045 notes->widths.target, addr);
3047 notes->options->offset_level >= ANNOTATION__OFFSET_CALL) {
3049 } else if (notes->options->offset_level == ANNOTATION__MAX_OFFSET_LEVEL) {
3053 notes->widths.addr, " ");
3063 disasm_line__write(disasm_line(al), notes, obj, bf, sizeof(bf), obj__printf, obj__write_graph);
3070 void annotation_line__write(struct annotation_line *al, struct annotation *notes,
3074 __annotation_line__write(al, notes, wops->first_line, wops->current_entry,
3086 struct annotation *notes = symbol__annotation(sym);
3090 notes->offsets = zalloc(size * sizeof(struct annotation_line *));
3091 if (notes->offsets == NULL)
3101 notes->options = options;
3105 annotation__set_offsets(notes, size);
3106 annotation__mark_jump_targets(notes, sym);
3107 annotation__compute_ipc(notes, size);
3108 annotation__init_column_widths(notes, sym);
3109 notes->nr_events = nr_pcnt;
3111 annotation__update_column_widths(notes);
3117 zfree(&notes->offsets);