Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269045
b: refs/heads/master
c: 81cce8d
h: refs/heads/master
i:
  269043: befdbc7
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Oct 7, 2011
1 parent 50da4dd commit 921a1cc
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 57 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1980c2ebd7020d82c024b8c4046849b38e78e7da
refs/heads/master: 81cce8de9437be9234f651be1f03e596c1b1a79a
2 changes: 1 addition & 1 deletion trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static void hists__find_annotations(struct hists *self, int evidx)
}

if (use_browser > 0) {
key = hist_entry__tui_annotate(he, evidx);
key = hist_entry__tui_annotate(he, evidx, NULL, NULL, 0);
switch (key) {
case KEY_RIGHT:
next = rb_next(nd);
Expand Down
7 changes: 4 additions & 3 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,10 @@ static int __cmd_report(void)
goto out_delete;
}

if (use_browser > 0)
perf_evlist__tui_browse_hists(session->evlist, help);
else
if (use_browser > 0) {
perf_evlist__tui_browse_hists(session->evlist, help,
NULL, NULL, 0);
} else
perf_evlist__tty_browse_hists(session->evlist, help);

out_delete:
Expand Down
7 changes: 5 additions & 2 deletions trunk/tools/perf/util/annotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
#ifdef NO_NEWT_SUPPORT
static inline int symbol__tui_annotate(struct symbol *sym __used,
struct map *map __used,
int evidx __used, int refresh __used)
int evidx __used,
void(*timer)(void *arg) __used,
void *arg __used, int delay_secs __used)
{
return 0;
}
#else
int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
int refresh);
void(*timer)(void *arg), void *arg,
int delay_secs);
#endif

extern const char *disassembler_style;
Expand Down
6 changes: 6 additions & 0 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,3 +533,9 @@ bool perf_evlist__sample_id_all(const struct perf_evlist *evlist)
first = list_entry(evlist->entries.next, struct perf_evsel, node);
return first->attr.sample_id_all;
}

void perf_evlist__set_selected(struct perf_evlist *evlist,
struct perf_evsel *evsel)
{
evlist->selected = evsel;
}
4 changes: 4 additions & 0 deletions trunk/tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct perf_evlist {
struct pollfd *pollfd;
struct thread_map *threads;
struct cpu_map *cpus;
struct perf_evsel *selected;
};

struct perf_evsel;
Expand Down Expand Up @@ -56,6 +57,9 @@ void perf_evlist__munmap(struct perf_evlist *evlist);
void perf_evlist__disable(struct perf_evlist *evlist);
void perf_evlist__enable(struct perf_evlist *evlist);

void perf_evlist__set_selected(struct perf_evlist *evlist,
struct perf_evsel *evsel);

static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
struct cpu_map *cpus,
struct thread_map *threads)
Expand Down
14 changes: 10 additions & 4 deletions trunk/tools/perf/util/hist.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,32 @@ struct perf_evlist;
#ifdef NO_NEWT_SUPPORT
static inline
int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used,
const char *help __used)
const char *help __used, void(*timer)(void *arg) __used, void *arg,
int refresh __used)
{
return 0;
}

static inline int hist_entry__tui_annotate(struct hist_entry *self __used,
int evidx __used)
int evidx __used,
void(*timer)(void *arg) __used,
void *arg __used, int delay_secs __used);
{
return 0;
}
#define KEY_LEFT -1
#define KEY_RIGHT -2
#else
#include <newt.h>
int hist_entry__tui_annotate(struct hist_entry *self, int evidx);
int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
void(*timer)(void *arg), void *arg, int delay_secs);

#define KEY_LEFT NEWT_KEY_LEFT
#define KEY_RIGHT NEWT_KEY_RIGHT

int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help);
int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
void(*timer)(void *arg), void *arg,
int refresh);
#endif

unsigned int hists__sort_list_width(struct hists *self);
Expand Down
25 changes: 16 additions & 9 deletions trunk/tools/perf/util/ui/browsers/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
}

static int annotate_browser__run(struct annotate_browser *self, int evidx,
int refresh)
void(*timer)(void *arg) __used, void *arg __used,
int delay_secs)
{
struct rb_node *nd = NULL;
struct symbol *sym = self->b.priv;
Expand All @@ -189,13 +190,13 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,

nd = self->curr_hot;

if (refresh != 0)
newtFormSetTimer(self->b.form, refresh);
if (delay_secs != 0)
newtFormSetTimer(self->b.form, delay_secs * 1000);

while (1) {
key = ui_browser__run(&self->b);

if (refresh != 0) {
if (delay_secs != 0) {
annotate_browser__calc_percent(self, evidx);
/*
* Current line focus got out of the list of most active
Expand All @@ -212,7 +213,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
* FIXME we need to check if it was
* es.reason == NEWT_EXIT_TIMER
*/
if (refresh != 0)
if (timer != NULL)
timer(arg);

if (delay_secs != 0)
symbol__annotate_decay_histogram(sym, evidx);
continue;
case NEWT_KEY_TAB:
Expand Down Expand Up @@ -246,13 +250,16 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
return key;
}

int hist_entry__tui_annotate(struct hist_entry *he, int evidx)
int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
void(*timer)(void *arg), void *arg, int delay_secs)
{
return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx, 0);
return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx,
timer, arg, delay_secs);
}

int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
int refresh)
void(*timer)(void *arg), void *arg,
int delay_secs)
{
struct objdump_line *pos, *n;
struct annotation *notes;
Expand Down Expand Up @@ -293,7 +300,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,

browser.b.entries = &notes->src->source,
browser.b.width += 18; /* Percentage */
ret = annotate_browser__run(&browser, evidx, refresh);
ret = annotate_browser__run(&browser, evidx, timer, arg, delay_secs);
list_for_each_entry_safe(pos, n, &notes->src->source, node) {
list_del(&pos->node);
objdump_line__free(pos);
Expand Down
Loading

0 comments on commit 921a1cc

Please sign in to comment.