builtin-annotate.c (e3c55d406bd8df1a878546002c93db90c42be10c) builtin-annotate.c (fc67297b16da335d610af2fac96233d51146300a)
1/*
2 * builtin-annotate.c
3 *
4 * Builtin annotate command: Analyze the perf.data input file,
5 * look up and read DSOs and symbol information and display
6 * a histogram of results, along various sorting keys.
7 */
8#include "builtin.h"

--- 16 unchanged lines hidden (view full) ---

25#include "util/parse-events.h"
26#include "util/thread.h"
27#include "util/sort.h"
28#include "util/hist.h"
29#include "util/session.h"
30#include "util/tool.h"
31#include "arch/common.h"
32
1/*
2 * builtin-annotate.c
3 *
4 * Builtin annotate command: Analyze the perf.data input file,
5 * look up and read DSOs and symbol information and display
6 * a histogram of results, along various sorting keys.
7 */
8#include "builtin.h"

--- 16 unchanged lines hidden (view full) ---

25#include "util/parse-events.h"
26#include "util/thread.h"
27#include "util/sort.h"
28#include "util/hist.h"
29#include "util/session.h"
30#include "util/tool.h"
31#include "arch/common.h"
32
33#include <dlfcn.h>
33#include <linux/bitmap.h>
34
35struct perf_annotate {
36 struct perf_tool tool;
37 bool force, use_tui, use_stdio, use_gtk;
38 bool full_paths;
39 bool print_line;
40 bool skip_missing;

--- 17 unchanged lines hidden (view full) ---

58 if (al->sym != NULL) {
59 rb_erase(&al->sym->rb_node,
60 &al->map->dso->symbols[al->map->type]);
61 symbol__delete(al->sym);
62 }
63 return 0;
64 }
65
34#include <linux/bitmap.h>
35
36struct perf_annotate {
37 struct perf_tool tool;
38 bool force, use_tui, use_stdio, use_gtk;
39 bool full_paths;
40 bool print_line;
41 bool skip_missing;

--- 17 unchanged lines hidden (view full) ---

59 if (al->sym != NULL) {
60 rb_erase(&al->sym->rb_node,
61 &al->map->dso->symbols[al->map->type]);
62 symbol__delete(al->sym);
63 }
64 return 0;
65 }
66
66 he = __hists__add_entry(&evsel->hists, al, NULL, 1, 1);
67 he = __hists__add_entry(&evsel->hists, al, NULL, 1, 1, 0);
67 if (he == NULL)
68 return -ENOMEM;
69
70 ret = 0;
71 if (he->ms.sym != NULL) {
72 struct annotation *notes = symbol__annotation(he->ms.sym);
73 if (notes->src == NULL && symbol__alloc_hist(he->ms.sym) < 0)
74 return -ENOMEM;

--- 62 unchanged lines hidden (view full) ---

137 nd = rb_prev(nd);
138 else
139 nd = rb_next(nd);
140 continue;
141 }
142
143 if (use_browser == 2) {
144 int ret;
68 if (he == NULL)
69 return -ENOMEM;
70
71 ret = 0;
72 if (he->ms.sym != NULL) {
73 struct annotation *notes = symbol__annotation(he->ms.sym);
74 if (notes->src == NULL && symbol__alloc_hist(he->ms.sym) < 0)
75 return -ENOMEM;

--- 62 unchanged lines hidden (view full) ---

138 nd = rb_prev(nd);
139 else
140 nd = rb_next(nd);
141 continue;
142 }
143
144 if (use_browser == 2) {
145 int ret;
146 int (*annotate)(struct hist_entry *he,
147 struct perf_evsel *evsel,
148 struct hist_browser_timer *hbt);
145
149
146 ret = hist_entry__gtk_annotate(he, evsel, NULL);
150 annotate = dlsym(perf_gtk_handle,
151 "hist_entry__gtk_annotate");
152 if (annotate == NULL) {
153 ui__error("GTK browser not found!\n");
154 return;
155 }
156
157 ret = annotate(he, evsel, NULL);
147 if (!ret || !ann->skip_missing)
148 return;
149
150 /* skip missing symbols */
151 nd = rb_next(nd);
152 } else if (use_browser == 1) {
153 key = hist_entry__tui_annotate(he, evsel, NULL);
154 switch (key) {

--- 87 unchanged lines hidden (view full) ---

242 }
243 }
244
245 if (total_nr_samples == 0) {
246 ui__error("The %s file has no samples!\n", session->filename);
247 goto out_delete;
248 }
249
158 if (!ret || !ann->skip_missing)
159 return;
160
161 /* skip missing symbols */
162 nd = rb_next(nd);
163 } else if (use_browser == 1) {
164 key = hist_entry__tui_annotate(he, evsel, NULL);
165 switch (key) {

--- 87 unchanged lines hidden (view full) ---

253 }
254 }
255
256 if (total_nr_samples == 0) {
257 ui__error("The %s file has no samples!\n", session->filename);
258 goto out_delete;
259 }
260
250 if (use_browser == 2)
251 perf_gtk__show_annotations();
261 if (use_browser == 2) {
262 void (*show_annotations)(void);
252
263
264 show_annotations = dlsym(perf_gtk_handle,
265 "perf_gtk__show_annotations");
266 if (show_annotations == NULL) {
267 ui__error("GTK browser not found!\n");
268 goto out_delete;
269 }
270 show_annotations();
271 }
272
253out_delete:
254 /*
255 * Speed up the exit process, for large files this can
256 * take quite a while.
257 *
258 * XXX Enable this when using valgrind or if we ever
259 * librarize this command.
260 *

--- 101 unchanged lines hidden ---
273out_delete:
274 /*
275 * Speed up the exit process, for large files this can
276 * take quite a while.
277 *
278 * XXX Enable this when using valgrind or if we ever
279 * librarize this command.
280 *

--- 101 unchanged lines hidden ---