Lines Matching refs:notes

6  * copyright notes.
851 struct annotation *notes = symbol__annotation(sym);
854 notes->src->cycles_hist = calloc(size, sizeof(struct cyc_hist));
855 if (notes->src->cycles_hist == NULL)
862 struct annotation *notes = symbol__annotation(sym);
864 annotation__lock(notes);
865 if (notes->src != NULL) {
866 memset(notes->src->histograms, 0,
867 notes->src->nr_histograms * notes->src->sizeof_sym_hist);
868 if (notes->src->cycles_hist)
869 memset(notes->src->cycles_hist, 0,
872 annotation__unlock(notes);
963 struct annotation *notes = symbol__annotation(sym);
965 if (notes->src == NULL) {
966 notes->src = annotated_source__new();
967 if (notes->src == NULL)
972 if (!notes->src->cycles_hist) {
977 return notes->src->cycles_hist;
982 struct annotation *notes = symbol__annotation(sym);
984 if (notes->src == NULL) {
985 notes->src = annotated_source__new();
986 if (notes->src == NULL)
991 if (notes->src->histograms == NULL) {
993 annotated_source__alloc_histograms(notes->src, symbol__size(sym),
997 return notes->src;
1074 static unsigned annotation__count_insn(struct annotation *notes, u64 start, u64 end)
1080 if (notes->offsets[offset])
1086 static void annotation__count_and_fill(struct annotation *notes, u64 start, u64 end, struct cyc_hist *ch)
1092 n_insn = annotation__count_insn(notes, start, end);
1101 struct annotation_line *al = notes->offsets[offset];
1110 notes->hit_cycles += ch->cycles;
1111 notes->hit_insn += n_insn * ch->num;
1112 notes->cover_insn += cover_insn;
1117 void annotation__compute_ipc(struct annotation *notes, size_t size)
1121 if (!notes->src || !notes->src->cycles_hist)
1124 notes->total_insn = annotation__count_insn(notes, 0, size - 1);
1125 notes->hit_cycles = 0;
1126 notes->hit_insn = 0;
1127 notes->cover_insn = 0;
1129 annotation__lock(notes);
1133 ch = &notes->src->cycles_hist[offset];
1138 annotation__count_and_fill(notes, ch->start, offset, ch);
1139 al = notes->offsets[offset];
1145 notes->have_cycles = true;
1148 annotation__unlock(notes);
1299 void annotation__exit(struct annotation *notes)
1301 annotated_source__delete(notes->src);
1312 static size_t annotation__hash(const struct annotation *notes)
1314 return (size_t)notes;
1317 static struct mutex *annotation__get_mutex(const struct annotation *notes)
1325 return sharded_mutex__get_mutex(sharded_mutex, annotation__hash(notes));
1328 void annotation__lock(struct annotation *notes)
1331 struct mutex *mutex = annotation__get_mutex(notes);
1337 void annotation__unlock(struct annotation *notes)
1340 struct mutex *mutex = annotation__get_mutex(notes);
1346 bool annotation__trylock(struct annotation *notes)
1348 struct mutex *mutex = annotation__get_mutex(notes);
1480 struct annotation *notes = symbol__annotation(sym);
1502 list_for_each_entry_from(queue, &notes->src->source, node) {
1592 struct annotation *notes = symbol__annotation(sym);
1649 annotation_line__add(&dl->al, &notes->src->source);
1660 struct annotation *notes = symbol__annotation(sym);
1661 struct list_head *list = &notes->src->source;
1819 struct annotation *notes = symbol__annotation(sym);
1939 &notes->src->source);
1950 annotation_line__add(&dl->al, &notes->src->source);
1975 struct annotation *notes = symbol__annotation(sym);
1984 annotation_line__add(&dl->al, &notes->src->source);
2264 static void annotation__calc_percent(struct annotation *notes,
2270 list_for_each_entry(al, &notes->src->source, node) {
2277 next = annotation_line__next(al, &notes->src->source);
2287 sym_hist = annotation__histogram(notes, evsel->core.idx);
2297 struct annotation *notes = symbol__annotation(sym);
2299 annotation__calc_percent(notes, evsel, symbol__size(sym));
2306 struct annotation *notes = symbol__annotation(sym);
2337 if (notes->options && notes->options->full_addr)
2338 notes->start = map__objdump_2mem(ms->map, ms->sym->start);
2340 notes->start = map__rip_2objdump(ms->map, ms->sym->start);
2472 struct annotation *notes = symbol__annotation(sym);
2473 struct sym_hist *h = annotation__histogram(notes, evsel->core.idx);
2505 struct annotation *notes = symbol__annotation(sym);
2506 struct sym_hist *h = annotation__histogram(notes, evsel->core.idx);
2547 addr_fmt_width = annotated_source__addr_fmt_width(&notes->src->source, start);
2549 list_for_each_entry(pos, &notes->src->source, node) {
2639 struct annotation *notes = symbol__annotation(sym);
2651 list_for_each_entry(al, &notes->src->source, node) {
2652 if (annotation_line__filter(al, notes))
2654 annotation_line__write(al, notes, &wops, opts);
2696 struct annotation *notes = symbol__annotation(sym);
2697 struct sym_hist *h = annotation__histogram(notes, evidx);
2699 memset(h, 0, notes->src->sizeof_sym_hist);
2704 struct annotation *notes = symbol__annotation(sym);
2705 struct sym_hist *h = annotation__histogram(notes, evidx);
2763 void annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym)
2772 struct annotation_line *al = notes->offsets[offset];
2780 al = notes->offsets[dl->ops.target.offset];
2789 if (++al->jump_sources > notes->max_jump_sources)
2790 notes->max_jump_sources = al->jump_sources;
2794 void annotation__set_offsets(struct annotation *notes, s64 size)
2798 notes->max_line_len = 0;
2799 notes->nr_entries = 0;
2800 notes->nr_asm_entries = 0;
2802 list_for_each_entry(al, &notes->src->source, node) {
2805 if (notes->max_line_len < line_len)
2806 notes->max_line_len = line_len;
2807 al->idx = notes->nr_entries++;
2809 al->idx_asm = notes->nr_asm_entries++;
2818 notes->offsets[al->offset] = al;
2833 static int annotation__max_ins_name(struct annotation *notes)
2838 list_for_each_entry(al, &notes->src->source, node) {
2850 void annotation__init_column_widths(struct annotation *notes, struct symbol *sym)
2852 notes->widths.addr = notes->widths.target =
2853 notes->widths.min_addr = hex_width(symbol__size(sym));
2854 notes->widths.max_addr = hex_width(sym->end);
2855 notes->widths.jumps = width_jumps(notes->max_jump_sources);
2856 notes->widths.max_ins_name = annotation__max_ins_name(notes);
2859 void annotation__update_column_widths(struct annotation *notes)
2861 if (notes->options->use_offset)
2862 notes->widths.target = notes->widths.min_addr;
2863 else if (notes->options->full_addr)
2864 notes->widths.target = BITS_PER_LONG / 4;
2866 notes->widths.target = notes->widths.max_addr;
2868 notes->widths.addr = notes->widths.target;
2870 if (notes->options->show_nr_jumps)
2871 notes->widths.addr += notes->widths.jumps + 1;
2874 void annotation__toggle_full_addr(struct annotation *notes, struct map_symbol *ms)
2876 notes->options->full_addr = !notes->options->full_addr;
2878 if (notes->options->full_addr)
2879 notes->start = map__objdump_2mem(ms->map, ms->sym->start);
2881 notes->start = map__rip_2objdump(ms->map, ms->sym->start);
2883 annotation__update_column_widths(notes);
2886 static void annotation__calc_lines(struct annotation *notes, struct map *map,
2893 list_for_each_entry(al, &notes->src->source, node) {
2910 al->path = get_srcline(map__dso(map), notes->start + al->offset, NULL,
2911 false, true, notes->start + al->offset);
2921 struct annotation *notes = symbol__annotation(ms->sym);
2923 annotation__calc_lines(notes, ms->map, root, opts);
3002 struct annotation *notes,
3008 for (i = 0; i < notes->nr_events; i++) {
3021 static void disasm_line__write(struct disasm_line *dl, struct annotation *notes,
3049 disasm_line__scnprintf(dl, bf, size, !notes->options->use_offset, notes->widths.max_ins_name);
3052 static void ipc_coverage_string(char *bf, int size, struct annotation *notes)
3056 if (notes->hit_cycles)
3057 ipc = notes->hit_insn / ((double)notes->hit_cycles);
3059 if (notes->total_insn) {
3060 coverage = notes->cover_insn * 100.0 /
3061 ((double)notes->total_insn);
3068 static void __annotation_line__write(struct annotation_line *al, struct annotation *notes,
3078 double percent_max = annotation_line__max_percent(al, notes, percent_type);
3079 int pcnt_width = annotation__pcnt_width(notes),
3080 cycles_width = annotation__cycles_width(notes);
3086 if (notes->have_cycles) {
3096 for (i = 0; i < notes->nr_events; i++) {
3123 if (notes->have_cycles) {
3131 if (!notes->options->show_minmax_cycle) {
3165 ipc_coverage_string(bf, sizeof(bf), notes);
3175 if (al->line_nr && notes->options->show_linenr)
3176 printed = scnprintf(bf, sizeof(bf), "%-*d ", notes->widths.addr + 1, al->line_nr);
3178 printed = scnprintf(bf, sizeof(bf), "%-*s ", notes->widths.addr, " ");
3185 if (!notes->options->use_offset)
3186 addr += notes->start;
3188 if (!notes->options->use_offset) {
3192 notes->options->offset_level >= ANNOTATION__OFFSET_JUMP_TARGETS) {
3193 if (notes->options->show_nr_jumps) {
3196 notes->widths.jumps,
3205 notes->widths.target, addr);
3207 notes->options->offset_level >= ANNOTATION__OFFSET_CALL) {
3209 } else if (notes->options->offset_level == ANNOTATION__MAX_OFFSET_LEVEL) {
3213 notes->widths.addr, " ");
3223 disasm_line__write(disasm_line(al), notes, obj, bf, sizeof(bf), obj__printf, obj__write_graph);
3230 void annotation_line__write(struct annotation_line *al, struct annotation *notes,
3234 __annotation_line__write(al, notes, wops->first_line, wops->current_entry,
3246 struct annotation *notes = symbol__annotation(sym);
3250 notes->offsets = zalloc(size * sizeof(struct annotation_line *));
3251 if (notes->offsets == NULL)
3261 notes->options = options;
3265 annotation__set_offsets(notes, size);
3266 annotation__mark_jump_targets(notes, sym);
3267 annotation__compute_ipc(notes, size);
3268 annotation__init_column_widths(notes, sym);
3269 notes->nr_events = nr_pcnt;
3271 annotation__update_column_widths(notes);
3277 zfree(&notes->offsets);