summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 4087ab1..5ebd0c3 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -28,10 +28,8 @@
#include "util/hist.h"
#include "util/session.h"
#include "util/tool.h"
-#include "util/data.h"
#include "arch/common.h"
-#include <dlfcn.h>
#include <linux/bitmap.h>
struct perf_annotate {
@@ -65,7 +63,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
return 0;
}
- he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0);
+ he = __hists__add_entry(&evsel->hists, al, NULL, 1, 1);
if (he == NULL)
return -ENOMEM;
@@ -118,11 +116,11 @@ static int hist_entry__tty_annotate(struct hist_entry *he,
ann->print_line, ann->full_paths, 0, 0);
}
-static void hists__find_annotations(struct hists *hists,
+static void hists__find_annotations(struct hists *self,
struct perf_evsel *evsel,
struct perf_annotate *ann)
{
- struct rb_node *nd = rb_first(&hists->entries), *next;
+ struct rb_node *nd = rb_first(&self->entries), *next;
int key = K_RIGHT;
while (nd) {
@@ -144,18 +142,8 @@ find_next:
if (use_browser == 2) {
int ret;
- int (*annotate)(struct hist_entry *he,
- struct perf_evsel *evsel,
- struct hist_browser_timer *hbt);
-
- annotate = dlsym(perf_gtk_handle,
- "hist_entry__gtk_annotate");
- if (annotate == NULL) {
- ui__error("GTK browser not found!\n");
- return;
- }
- ret = annotate(he, evsel, NULL);
+ ret = hist_entry__gtk_annotate(he, evsel, NULL);
if (!ret || !ann->skip_missing)
return;
@@ -200,13 +188,9 @@ static int __cmd_annotate(struct perf_annotate *ann)
struct perf_session *session;
struct perf_evsel *pos;
u64 total_nr_samples;
- struct perf_data_file file = {
- .path = input_name,
- .mode = PERF_DATA_MODE_READ,
- .force = ann->force,
- };
- session = perf_session__new(&file, false, &ann->tool);
+ session = perf_session__new(input_name, O_RDONLY,
+ ann->force, false, &ann->tool);
if (session == NULL)
return -ENOMEM;
@@ -247,7 +231,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
if (nr_samples > 0) {
total_nr_samples += nr_samples;
- hists__collapse_resort(hists, NULL);
+ hists__collapse_resort(hists);
hists__output_resort(hists);
if (symbol_conf.event_group &&
@@ -259,21 +243,12 @@ static int __cmd_annotate(struct perf_annotate *ann)
}
if (total_nr_samples == 0) {
- ui__error("The %s file has no samples!\n", file.path);
+ ui__error("The %s file has no samples!\n", session->filename);
goto out_delete;
}
- if (use_browser == 2) {
- void (*show_annotations)(void);
-
- show_annotations = dlsym(perf_gtk_handle,
- "perf_gtk__show_annotations");
- if (show_annotations == NULL) {
- ui__error("GTK browser not found!\n");
- goto out_delete;
- }
- show_annotations();
- }
+ if (use_browser == 2)
+ perf_gtk__show_annotations();
out_delete:
/*