* [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol
@ 2012-03-16 8:50 Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window Namhyung Kim
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Namhyung Kim @ 2012-03-16 8:50 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
This function will be used for simple (sub-)string matching
filter based on user input.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/util/hist.c | 35 +++++++++++++++++++++++++++++++++++
tools/perf/util/hist.h | 2 ++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 8380c3db1c92..2c624ad371a7 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -10,11 +10,14 @@ static bool hists__filter_entry_by_dso(struct hists *hists,
struct hist_entry *he);
static bool hists__filter_entry_by_thread(struct hists *hists,
struct hist_entry *he);
+static bool hists__filter_entry_by_symbol(struct hists *hists,
+ struct hist_entry *he);
enum hist_filter {
HIST_FILTER__DSO,
HIST_FILTER__THREAD,
HIST_FILTER__PARENT,
+ HIST_FILTER__SYMBOL,
};
struct callchain_param callchain_param = {
@@ -420,6 +423,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
{
hists__filter_entry_by_dso(hists, he);
hists__filter_entry_by_thread(hists, he);
+ hists__filter_entry_by_symbol(hists, he);
}
static void __hists__collapse_resort(struct hists *hists, bool threaded)
@@ -1247,6 +1251,37 @@ void hists__filter_by_thread(struct hists *hists)
}
}
+static bool hists__filter_entry_by_symbol(struct hists *hists,
+ struct hist_entry *he)
+{
+ if (hists->symbol_filter_str != NULL &&
+ (!he->ms.sym || strstr(he->ms.sym->name,
+ hists->symbol_filter_str) == NULL)) {
+ he->filtered |= (1 << HIST_FILTER__SYMBOL);
+ return true;
+ }
+
+ return false;
+}
+
+void hists__filter_by_symbol(struct hists *hists)
+{
+ struct rb_node *nd;
+
+ hists->nr_entries = hists->stats.total_period = 0;
+ hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
+ hists__reset_col_len(hists);
+
+ for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
+ struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+
+ if (hists__filter_entry_by_symbol(hists, h))
+ continue;
+
+ hists__remove_entry_filter(hists, h, HIST_FILTER__SYMBOL);
+ }
+}
+
int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip)
{
return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 9413f3e31fea..10343c081e19 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -62,6 +62,7 @@ struct hists {
const struct thread *thread_filter;
const struct dso *dso_filter;
const char *uid_filter_str;
+ const char *symbol_filter_str;
pthread_mutex_t lock;
struct events_stats stats;
u64 event_stream;
@@ -107,6 +108,7 @@ int hist_entry__annotate(struct hist_entry *self, size_t privsize);
void hists__filter_by_dso(struct hists *hists);
void hists__filter_by_thread(struct hists *hists);
+void hists__filter_by_symbol(struct hists *hists);
u16 hists__col_len(struct hists *self, enum hist_column col);
void hists__set_col_len(struct hists *self, enum hist_column col, u16 len);
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window
2012-03-16 8:50 [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol Namhyung Kim
@ 2012-03-16 8:50 ` Namhyung Kim
2012-03-16 19:40 ` Arnaldo Carvalho de Melo
2012-03-19 20:03 ` [tip:perf/core] perf ui browser: Introduce ui_browser__input_window tip-bot for Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 3/5] perf ui browser: Add 's' key to filter by symbol name Namhyung Kim
` (3 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Namhyung Kim @ 2012-03-16 8:50 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
The ui_browser__input_window() function is to get user's key input.
Current implementation can handle maximum 49 characters.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/util/ui/browser.h | 2 +
tools/perf/util/ui/keysyms.h | 2 +
tools/perf/util/ui/util.c | 78 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 84d761b730c1..6ee82f60feaf 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -49,6 +49,8 @@ int ui_browser__warning(struct ui_browser *browser, int timeout,
const char *format, ...);
int ui_browser__help_window(struct ui_browser *browser, const char *text);
bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text);
+int ui_browser__input_window(const char *title, const char *text, char *input,
+ const char *exit_msg, int delay_sec);
void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence);
unsigned int ui_browser__argv_refresh(struct ui_browser *browser);
diff --git a/tools/perf/util/ui/keysyms.h b/tools/perf/util/ui/keysyms.h
index 3458b1985761..809eca5707fa 100644
--- a/tools/perf/util/ui/keysyms.h
+++ b/tools/perf/util/ui/keysyms.h
@@ -16,6 +16,8 @@
#define K_TAB '\t'
#define K_UNTAB SL_KEY_UNTAB
#define K_UP SL_KEY_UP
+#define K_BKSPC 0x7f
+#define K_DEL SL_KEY_DELETE
/* Not really keys */
#define K_TIMER -1
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 45daa7c41dad..360f43fd5400 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -69,6 +69,84 @@ int ui__popup_menu(int argc, char * const argv[])
return popup_menu__run(&menu);
}
+int ui_browser__input_window(const char *title, const char *text, char *input,
+ const char *exit_msg, int delay_secs)
+{
+ int x, y, len, key;
+ int max_len = 60, nr_lines = 0;
+ static char buf[50];
+ const char *t;
+
+ t = text;
+ while (1) {
+ const char *sep = strchr(t, '\n');
+
+ if (sep == NULL)
+ sep = strchr(t, '\0');
+ len = sep - t;
+ if (max_len < len)
+ max_len = len;
+ ++nr_lines;
+ if (*sep == '\0')
+ break;
+ t = sep + 1;
+ }
+
+ max_len += 2;
+ nr_lines += 8;
+ y = SLtt_Screen_Rows / 2 - nr_lines / 2;
+ x = SLtt_Screen_Cols / 2 - max_len / 2;
+
+ SLsmg_set_color(0);
+ SLsmg_draw_box(y, x++, nr_lines, max_len);
+ if (title) {
+ SLsmg_gotorc(y, x + 1);
+ SLsmg_write_string((char *)title);
+ }
+ SLsmg_gotorc(++y, x);
+ nr_lines -= 7;
+ max_len -= 2;
+ SLsmg_write_wrapped_string((unsigned char *)text, y, x,
+ nr_lines, max_len, 1);
+ y += nr_lines + 1;
+ SLsmg_set_color(0);
+ SLsmg_draw_box(y - 1, x + 1, 3, max_len - 2);
+
+ SLsmg_gotorc(y + 3, x);
+ SLsmg_write_nstring((char *)exit_msg, max_len);
+ SLsmg_refresh();
+
+ x += 2;
+ len = 0;
+ key = ui__getch(delay_secs);
+ while (key != K_TIMER && key != K_ENTER && key != K_ESC) {
+ if (key == K_BKSPC) {
+ if (len == 0)
+ goto next_key;
+ SLsmg_gotorc(y, x + --len);
+ SLsmg_write_char(' ');
+ } else {
+ buf[len] = key;
+ SLsmg_gotorc(y, x + len++);
+ SLsmg_write_char(key);
+ }
+ SLsmg_refresh();
+
+ /* XXX more graceful overflow handling needed */
+ if (len == sizeof(buf) - 1) {
+ ui_helpline__push("maximum size of symbol name reached!");
+ key = K_ENTER;
+ break;
+ }
+next_key:
+ key = ui__getch(delay_secs);
+ }
+
+ buf[len] = '\0';
+ strncpy(input, buf, len+1);
+ return key;
+}
+
int ui__question_window(const char *title, const char *text,
const char *exit_msg, int delay_secs)
{
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/5] perf ui browser: Add 's' key to filter by symbol name
2012-03-16 8:50 [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window Namhyung Kim
@ 2012-03-16 8:50 ` Namhyung Kim
2012-03-19 20:03 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 4/5] perf report: Add --symbol-filter option Namhyung Kim
` (2 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-03-16 8:50 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
Now user can enter symbol name interested via ui_browser__input_window,
and perf can process it using hists__filter_by_symbol(). Giving empty
symbol (by pressing 's' followed by ENTER) will disable the filtering.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/util/ui/browsers/hists.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index de8ece8bcce3..c4173c9733bb 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -879,6 +879,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
char *options[16];
int nr_options = 0;
int key = -1;
+ char buf[64];
if (browser == NULL)
return -1;
@@ -933,6 +934,16 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto zoom_dso;
case 't':
goto zoom_thread;
+ case 's':
+ if (ui_browser__input_window("Symbol to show",
+ "Please enter the name of symbol you want to see",
+ buf, "ENTER: OK, ESC: Cancel",
+ delay_secs * 2) == K_ENTER) {
+ self->symbol_filter_str = *buf ? buf : NULL;
+ hists__filter_by_symbol(self);
+ hist_browser__reset(browser);
+ }
+ continue;
case K_F1:
case 'h':
case '?':
@@ -950,7 +961,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
"C Collapse all callchains\n"
"E Expand all callchains\n"
"d Zoom into current DSO\n"
- "t Zoom into current Thread");
+ "t Zoom into current Thread\n"
+ "s Filter symbol by name");
continue;
case K_ENTER:
case K_RIGHT:
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 4/5] perf report: Add --symbol-filter option
2012-03-16 8:50 [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 3/5] perf ui browser: Add 's' key to filter by symbol name Namhyung Kim
@ 2012-03-16 8:50 ` Namhyung Kim
2012-03-16 19:42 ` Arnaldo Carvalho de Melo
2012-03-19 20:04 ` [tip:perf/core] perf report: Add " tip-bot for Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 5/5] perf report: Treat an argument as a symbol filter Namhyung Kim
2012-03-19 20:02 ` [tip:perf/core] perf hists: Add hists__filter_by_symbol tip-bot for Namhyung Kim
4 siblings, 2 replies; 16+ messages in thread
From: Namhyung Kim @ 2012-03-16 8:50 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
Add new --symbol-filter command line option to set appropriate
filter string. Its short version is missing as I couldn't find
an ideal one and --filter option of perf record also has no
short version.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/builtin-report.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8e91c6eba18a..80fb90741b64 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -50,6 +50,7 @@ struct perf_report {
const char *pretty_printing_style;
symbol_filter_t annotate_init;
const char *cpu_list;
+ const char *symbol_filter_str;
DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
};
@@ -400,6 +401,9 @@ static int __cmd_report(struct perf_report *rep)
list_for_each_entry(pos, &session->evlist->entries, node) {
struct hists *hists = &pos->hists;
+ if (pos->idx == 0)
+ hists->symbol_filter_str = rep->symbol_filter_str;
+
hists__collapse_resort(hists);
hists__output_resort(hists);
nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
@@ -591,6 +595,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
"only consider symbols in these comms"),
OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
"only consider these symbols"),
+ OPT_STRING(0, "symbol-filter", &report.symbol_filter_str, "filter",
+ "only show symbols that (partially) match with this filter"),
OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
"width[,width...]",
"don't try to adjust column width, use these fixed values"),
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 5/5] perf report: Treat an argument as a symbol filter
2012-03-16 8:50 [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol Namhyung Kim
` (2 preceding siblings ...)
2012-03-16 8:50 ` [PATCH v2 4/5] perf report: Add --symbol-filter option Namhyung Kim
@ 2012-03-16 8:50 ` Namhyung Kim
2012-03-19 20:05 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-03-19 20:02 ` [tip:perf/core] perf hists: Add hists__filter_by_symbol tip-bot for Namhyung Kim
4 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-03-16 8:50 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
As Ingo requested, it'd be better off treating first (and the only)
argument as a symbol filter, so that user doesn't need to input the
symbol on the dialog window on TUI.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/builtin-report.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 80fb90741b64..c00545806bb7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -715,11 +715,16 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
} else
symbol_conf.exclude_other = false;
- /*
- * Any (unrecognized) arguments left?
- */
- if (argc)
- usage_with_options(report_usage, options);
+ if (argc) {
+ /*
+ * Special case: if there's an argument left then assume that
+ * it's a symbol filter:
+ */
+ if (argc > 1)
+ usage_with_options(report_usage, options);
+
+ report.symbol_filter_str = argv[0];
+ }
sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", stdout);
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window
2012-03-16 8:50 ` [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window Namhyung Kim
@ 2012-03-16 19:40 ` Arnaldo Carvalho de Melo
2012-03-19 2:46 ` [PATCH] perf ui browser: Clean lines inside of the input window Namhyung Kim
2012-03-19 20:03 ` [tip:perf/core] perf ui browser: Introduce ui_browser__input_window tip-bot for Namhyung Kim
1 sibling, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-03-16 19:40 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
Em Fri, Mar 16, 2012 at 05:50:52PM +0900, Namhyung Kim escreveu:
> The ui_browser__input_window() function is to get user's key input.
> Current implementation can handle maximum 49 characters.
You need to clean the lines with no strings using something like:
SLsmg_write_nstring((char *)" ", max_len);
After gotorcing there, etc. To avoid things like:
+ 1.29% perf [jbd2] [k] do_get_write_access
+ 1.19% init [kernel.kallsyms] [k] native_┌─Symbol to show─────────────────────────────────────────────┐
+ 0.78% swapper [kernel.kallsyms] [k] schedul│Please enter the name of symbol you want to see │
+ 0.63% init [kernel.kallsyms] [k] __hrtim│r_start_range_ns │
+ 0.62% firefox ld-2.12.so [.] __tls_g│t┌────────────────────────────────────────────────────────┐ │
+ 0.44% firefox [kernel.kallsyms] [k] avc_has│p│rm_noaudit │ │
+ 0.44% firefox libglib-2.0.so.0.2200.5 [.] g_slice│f└────────────────────────────────────────────────────────┘ │
+ 0.41% Xorg [kernel.kallsyms] [k] list_de│ │
+ 0.39% firefox [kernel.kallsyms] [k] read_ts│ENTER: OK, ESC: Cancel │
+ 0.38% init [kernel.kallsyms] [k] _spin_l└────────────────────────────────────────────────────────────┘
+ 0.36% firefox [kernel.kallsyms] [k] _spin_unlock_irqrestore
I'm applying this one, please send a fix on top of perf/core later when I ask
Ingo to pull the current backlog,
Thanks,
- Arnaldo
> Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
> ---
> tools/perf/util/ui/browser.h | 2 +
> tools/perf/util/ui/keysyms.h | 2 +
> tools/perf/util/ui/util.c | 78 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 82 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
> index 84d761b730c1..6ee82f60feaf 100644
> --- a/tools/perf/util/ui/browser.h
> +++ b/tools/perf/util/ui/browser.h
> @@ -49,6 +49,8 @@ int ui_browser__warning(struct ui_browser *browser, int timeout,
> const char *format, ...);
> int ui_browser__help_window(struct ui_browser *browser, const char *text);
> bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text);
> +int ui_browser__input_window(const char *title, const char *text, char *input,
> + const char *exit_msg, int delay_sec);
>
> void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence);
> unsigned int ui_browser__argv_refresh(struct ui_browser *browser);
> diff --git a/tools/perf/util/ui/keysyms.h b/tools/perf/util/ui/keysyms.h
> index 3458b1985761..809eca5707fa 100644
> --- a/tools/perf/util/ui/keysyms.h
> +++ b/tools/perf/util/ui/keysyms.h
> @@ -16,6 +16,8 @@
> #define K_TAB '\t'
> #define K_UNTAB SL_KEY_UNTAB
> #define K_UP SL_KEY_UP
> +#define K_BKSPC 0x7f
> +#define K_DEL SL_KEY_DELETE
>
> /* Not really keys */
> #define K_TIMER -1
> diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
> index 45daa7c41dad..360f43fd5400 100644
> --- a/tools/perf/util/ui/util.c
> +++ b/tools/perf/util/ui/util.c
> @@ -69,6 +69,84 @@ int ui__popup_menu(int argc, char * const argv[])
> return popup_menu__run(&menu);
> }
>
> +int ui_browser__input_window(const char *title, const char *text, char *input,
> + const char *exit_msg, int delay_secs)
> +{
> + int x, y, len, key;
> + int max_len = 60, nr_lines = 0;
> + static char buf[50];
> + const char *t;
> +
> + t = text;
> + while (1) {
> + const char *sep = strchr(t, '\n');
> +
> + if (sep == NULL)
> + sep = strchr(t, '\0');
> + len = sep - t;
> + if (max_len < len)
> + max_len = len;
> + ++nr_lines;
> + if (*sep == '\0')
> + break;
> + t = sep + 1;
> + }
> +
> + max_len += 2;
> + nr_lines += 8;
> + y = SLtt_Screen_Rows / 2 - nr_lines / 2;
> + x = SLtt_Screen_Cols / 2 - max_len / 2;
> +
> + SLsmg_set_color(0);
> + SLsmg_draw_box(y, x++, nr_lines, max_len);
> + if (title) {
> + SLsmg_gotorc(y, x + 1);
> + SLsmg_write_string((char *)title);
> + }
> + SLsmg_gotorc(++y, x);
> + nr_lines -= 7;
> + max_len -= 2;
> + SLsmg_write_wrapped_string((unsigned char *)text, y, x,
> + nr_lines, max_len, 1);
> + y += nr_lines + 1;
> + SLsmg_set_color(0);
> + SLsmg_draw_box(y - 1, x + 1, 3, max_len - 2);
> +
> + SLsmg_gotorc(y + 3, x);
> + SLsmg_write_nstring((char *)exit_msg, max_len);
> + SLsmg_refresh();
> +
> + x += 2;
> + len = 0;
> + key = ui__getch(delay_secs);
> + while (key != K_TIMER && key != K_ENTER && key != K_ESC) {
> + if (key == K_BKSPC) {
> + if (len == 0)
> + goto next_key;
> + SLsmg_gotorc(y, x + --len);
> + SLsmg_write_char(' ');
> + } else {
> + buf[len] = key;
> + SLsmg_gotorc(y, x + len++);
> + SLsmg_write_char(key);
> + }
> + SLsmg_refresh();
> +
> + /* XXX more graceful overflow handling needed */
> + if (len == sizeof(buf) - 1) {
> + ui_helpline__push("maximum size of symbol name reached!");
> + key = K_ENTER;
> + break;
> + }
> +next_key:
> + key = ui__getch(delay_secs);
> + }
> +
> + buf[len] = '\0';
> + strncpy(input, buf, len+1);
> + return key;
> +}
> +
> int ui__question_window(const char *title, const char *text,
> const char *exit_msg, int delay_secs)
> {
> --
> 1.7.9
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 4/5] perf report: Add --symbol-filter option
2012-03-16 8:50 ` [PATCH v2 4/5] perf report: Add --symbol-filter option Namhyung Kim
@ 2012-03-16 19:42 ` Arnaldo Carvalho de Melo
2012-03-19 2:53 ` [PATCH] perf report: Document " Namhyung Kim
2012-03-19 20:04 ` [tip:perf/core] perf report: Add " tip-bot for Namhyung Kim
1 sibling, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-03-16 19:42 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
Em Fri, Mar 16, 2012 at 05:50:54PM +0900, Namhyung Kim escreveu:
> Add new --symbol-filter command line option to set appropriate
> filter string. Its short version is missing as I couldn't find
> an ideal one and --filter option of perf record also has no
> short version.
You need to update tools/perf/Documentation/perf-report.txt, please send
a follow on patch.
> Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
> ---
> tools/perf/builtin-report.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 8e91c6eba18a..80fb90741b64 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -50,6 +50,7 @@ struct perf_report {
> const char *pretty_printing_style;
> symbol_filter_t annotate_init;
> const char *cpu_list;
> + const char *symbol_filter_str;
> DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
> };
>
> @@ -400,6 +401,9 @@ static int __cmd_report(struct perf_report *rep)
> list_for_each_entry(pos, &session->evlist->entries, node) {
> struct hists *hists = &pos->hists;
>
> + if (pos->idx == 0)
> + hists->symbol_filter_str = rep->symbol_filter_str;
> +
> hists__collapse_resort(hists);
> hists__output_resort(hists);
> nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
> @@ -591,6 +595,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
> "only consider symbols in these comms"),
> OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
> "only consider these symbols"),
> + OPT_STRING(0, "symbol-filter", &report.symbol_filter_str, "filter",
> + "only show symbols that (partially) match with this filter"),
> OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
> "width[,width...]",
> "don't try to adjust column width, use these fixed values"),
> --
> 1.7.9
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] perf ui browser: Clean lines inside of the input window
2012-03-16 19:40 ` Arnaldo Carvalho de Melo
@ 2012-03-19 2:46 ` Namhyung Kim
2012-03-19 20:06 ` [tip:perf/core] " tip-bot for Namhyung Kim
0 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-03-19 2:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
As Arnaldo pointed out, it should be cleared to prevent the window
from displaying overlapped strings on the region.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/util/ui/util.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 360f43fd5400..ad4374a16bb0 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -108,9 +108,13 @@ int ui_browser__input_window(const char *title, const char *text, char *input,
max_len -= 2;
SLsmg_write_wrapped_string((unsigned char *)text, y, x,
nr_lines, max_len, 1);
- y += nr_lines + 1;
- SLsmg_set_color(0);
- SLsmg_draw_box(y - 1, x + 1, 3, max_len - 2);
+ y += nr_lines;
+ len = 5;
+ while (len--) {
+ SLsmg_gotorc(y + len - 1, x);
+ SLsmg_write_nstring((char *)" ", max_len);
+ }
+ SLsmg_draw_box(y++, x + 1, 3, max_len - 2);
SLsmg_gotorc(y + 3, x);
SLsmg_write_nstring((char *)exit_msg, max_len);
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] perf report: Document --symbol-filter option
2012-03-16 19:42 ` Arnaldo Carvalho de Melo
@ 2012-03-19 2:53 ` Namhyung Kim
2012-03-19 20:07 ` [tip:perf/core] " tip-bot for Namhyung Kim
0 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-03-19 2:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML
Add missing description of --symbol-filter in Documentation/perf-report.txt.
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
tools/perf/Documentation/perf-report.txt | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 87feeee8b90c..68bbf9cec4b7 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -48,6 +48,9 @@ OPTIONS
Only consider these symbols. CSV that understands
file://filename entries.
+--symbol-filter=::
+ Only show symbols that match (partially) with this filter.
+
-U::
--hide-unresolved::
Only display entries resolved to a symbol.
--
1.7.9
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists: Add hists__filter_by_symbol
2012-03-16 8:50 [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol Namhyung Kim
` (3 preceding siblings ...)
2012-03-16 8:50 ` [PATCH v2 5/5] perf report: Treat an argument as a symbol filter Namhyung Kim
@ 2012-03-19 20:02 ` tip-bot for Namhyung Kim
4 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:02 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx, mingo
Commit-ID: e94d53ebec2fb4795c18ad2e76ec633390b1e794
Gitweb: http://git.kernel.org/tip/e94d53ebec2fb4795c18ad2e76ec633390b1e794
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Fri, 16 Mar 2012 17:50:51 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2012 16:31:09 -0300
perf hists: Add hists__filter_by_symbol
This function will be used for simple (sub-)string matching filter based
on user input.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1331887855-874-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 35 +++++++++++++++++++++++++++++++++++
tools/perf/util/hist.h | 2 ++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 8380c3d..2c624ad 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -10,11 +10,14 @@ static bool hists__filter_entry_by_dso(struct hists *hists,
struct hist_entry *he);
static bool hists__filter_entry_by_thread(struct hists *hists,
struct hist_entry *he);
+static bool hists__filter_entry_by_symbol(struct hists *hists,
+ struct hist_entry *he);
enum hist_filter {
HIST_FILTER__DSO,
HIST_FILTER__THREAD,
HIST_FILTER__PARENT,
+ HIST_FILTER__SYMBOL,
};
struct callchain_param callchain_param = {
@@ -420,6 +423,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
{
hists__filter_entry_by_dso(hists, he);
hists__filter_entry_by_thread(hists, he);
+ hists__filter_entry_by_symbol(hists, he);
}
static void __hists__collapse_resort(struct hists *hists, bool threaded)
@@ -1247,6 +1251,37 @@ void hists__filter_by_thread(struct hists *hists)
}
}
+static bool hists__filter_entry_by_symbol(struct hists *hists,
+ struct hist_entry *he)
+{
+ if (hists->symbol_filter_str != NULL &&
+ (!he->ms.sym || strstr(he->ms.sym->name,
+ hists->symbol_filter_str) == NULL)) {
+ he->filtered |= (1 << HIST_FILTER__SYMBOL);
+ return true;
+ }
+
+ return false;
+}
+
+void hists__filter_by_symbol(struct hists *hists)
+{
+ struct rb_node *nd;
+
+ hists->nr_entries = hists->stats.total_period = 0;
+ hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
+ hists__reset_col_len(hists);
+
+ for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
+ struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+
+ if (hists__filter_entry_by_symbol(hists, h))
+ continue;
+
+ hists__remove_entry_filter(hists, h, HIST_FILTER__SYMBOL);
+ }
+}
+
int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip)
{
return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 9413f3e..10343c0 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -62,6 +62,7 @@ struct hists {
const struct thread *thread_filter;
const struct dso *dso_filter;
const char *uid_filter_str;
+ const char *symbol_filter_str;
pthread_mutex_t lock;
struct events_stats stats;
u64 event_stream;
@@ -107,6 +108,7 @@ int hist_entry__annotate(struct hist_entry *self, size_t privsize);
void hists__filter_by_dso(struct hists *hists);
void hists__filter_by_thread(struct hists *hists);
+void hists__filter_by_symbol(struct hists *hists);
u16 hists__col_len(struct hists *self, enum hist_column col);
void hists__set_col_len(struct hists *self, enum hist_column col, u16 len);
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf ui browser: Introduce ui_browser__input_window
2012-03-16 8:50 ` [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window Namhyung Kim
2012-03-16 19:40 ` Arnaldo Carvalho de Melo
@ 2012-03-19 20:03 ` tip-bot for Namhyung Kim
1 sibling, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:03 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx, mingo
Commit-ID: aa49f6ec990baa9d8f1b46a86fc169a8028776d4
Gitweb: http://git.kernel.org/tip/aa49f6ec990baa9d8f1b46a86fc169a8028776d4
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Fri, 16 Mar 2012 17:50:52 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2012 16:32:36 -0300
perf ui browser: Introduce ui_browser__input_window
The ui_browser__input_window() function is to get user's key input.
Current implementation can handle maximum 49 characters.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1331887855-874-2-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/ui/browser.h | 2 +
tools/perf/util/ui/keysyms.h | 2 +
tools/perf/util/ui/util.c | 78 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 84d761b..6ee82f6 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -49,6 +49,8 @@ int ui_browser__warning(struct ui_browser *browser, int timeout,
const char *format, ...);
int ui_browser__help_window(struct ui_browser *browser, const char *text);
bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text);
+int ui_browser__input_window(const char *title, const char *text, char *input,
+ const char *exit_msg, int delay_sec);
void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence);
unsigned int ui_browser__argv_refresh(struct ui_browser *browser);
diff --git a/tools/perf/util/ui/keysyms.h b/tools/perf/util/ui/keysyms.h
index 3458b19..809eca5 100644
--- a/tools/perf/util/ui/keysyms.h
+++ b/tools/perf/util/ui/keysyms.h
@@ -16,6 +16,8 @@
#define K_TAB '\t'
#define K_UNTAB SL_KEY_UNTAB
#define K_UP SL_KEY_UP
+#define K_BKSPC 0x7f
+#define K_DEL SL_KEY_DELETE
/* Not really keys */
#define K_TIMER -1
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 45daa7c..360f43f 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -69,6 +69,84 @@ int ui__popup_menu(int argc, char * const argv[])
return popup_menu__run(&menu);
}
+int ui_browser__input_window(const char *title, const char *text, char *input,
+ const char *exit_msg, int delay_secs)
+{
+ int x, y, len, key;
+ int max_len = 60, nr_lines = 0;
+ static char buf[50];
+ const char *t;
+
+ t = text;
+ while (1) {
+ const char *sep = strchr(t, '\n');
+
+ if (sep == NULL)
+ sep = strchr(t, '\0');
+ len = sep - t;
+ if (max_len < len)
+ max_len = len;
+ ++nr_lines;
+ if (*sep == '\0')
+ break;
+ t = sep + 1;
+ }
+
+ max_len += 2;
+ nr_lines += 8;
+ y = SLtt_Screen_Rows / 2 - nr_lines / 2;
+ x = SLtt_Screen_Cols / 2 - max_len / 2;
+
+ SLsmg_set_color(0);
+ SLsmg_draw_box(y, x++, nr_lines, max_len);
+ if (title) {
+ SLsmg_gotorc(y, x + 1);
+ SLsmg_write_string((char *)title);
+ }
+ SLsmg_gotorc(++y, x);
+ nr_lines -= 7;
+ max_len -= 2;
+ SLsmg_write_wrapped_string((unsigned char *)text, y, x,
+ nr_lines, max_len, 1);
+ y += nr_lines + 1;
+ SLsmg_set_color(0);
+ SLsmg_draw_box(y - 1, x + 1, 3, max_len - 2);
+
+ SLsmg_gotorc(y + 3, x);
+ SLsmg_write_nstring((char *)exit_msg, max_len);
+ SLsmg_refresh();
+
+ x += 2;
+ len = 0;
+ key = ui__getch(delay_secs);
+ while (key != K_TIMER && key != K_ENTER && key != K_ESC) {
+ if (key == K_BKSPC) {
+ if (len == 0)
+ goto next_key;
+ SLsmg_gotorc(y, x + --len);
+ SLsmg_write_char(' ');
+ } else {
+ buf[len] = key;
+ SLsmg_gotorc(y, x + len++);
+ SLsmg_write_char(key);
+ }
+ SLsmg_refresh();
+
+ /* XXX more graceful overflow handling needed */
+ if (len == sizeof(buf) - 1) {
+ ui_helpline__push("maximum size of symbol name reached!");
+ key = K_ENTER;
+ break;
+ }
+next_key:
+ key = ui__getch(delay_secs);
+ }
+
+ buf[len] = '\0';
+ strncpy(input, buf, len+1);
+ return key;
+}
+
int ui__question_window(const char *title, const char *text,
const char *exit_msg, int delay_secs)
{
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf ui browser: Add 's' key to filter by symbol name
2012-03-16 8:50 ` [PATCH v2 3/5] perf ui browser: Add 's' key to filter by symbol name Namhyung Kim
@ 2012-03-19 20:03 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:03 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx, mingo
Commit-ID: 938a23ae7f656ffde9dd67e83dddf4406f85d773
Gitweb: http://git.kernel.org/tip/938a23ae7f656ffde9dd67e83dddf4406f85d773
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Fri, 16 Mar 2012 17:50:53 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2012 16:34:13 -0300
perf ui browser: Add 's' key to filter by symbol name
Now user can enter symbol name interested via ui_browser__input_window,
and perf can process it using hists__filter_by_symbol(). Giving empty
symbol (by pressing 's' followed by ENTER) will disable the filtering.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1331887855-874-3-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/ui/browsers/hists.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index de8ece8..c4173c9 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -879,6 +879,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
char *options[16];
int nr_options = 0;
int key = -1;
+ char buf[64];
if (browser == NULL)
return -1;
@@ -933,6 +934,16 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto zoom_dso;
case 't':
goto zoom_thread;
+ case 's':
+ if (ui_browser__input_window("Symbol to show",
+ "Please enter the name of symbol you want to see",
+ buf, "ENTER: OK, ESC: Cancel",
+ delay_secs * 2) == K_ENTER) {
+ self->symbol_filter_str = *buf ? buf : NULL;
+ hists__filter_by_symbol(self);
+ hist_browser__reset(browser);
+ }
+ continue;
case K_F1:
case 'h':
case '?':
@@ -950,7 +961,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
"C Collapse all callchains\n"
"E Expand all callchains\n"
"d Zoom into current DSO\n"
- "t Zoom into current Thread");
+ "t Zoom into current Thread\n"
+ "s Filter symbol by name");
continue;
case K_ENTER:
case K_RIGHT:
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf report: Add --symbol-filter option
2012-03-16 8:50 ` [PATCH v2 4/5] perf report: Add --symbol-filter option Namhyung Kim
2012-03-16 19:42 ` Arnaldo Carvalho de Melo
@ 2012-03-19 20:04 ` tip-bot for Namhyung Kim
1 sibling, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:04 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx, mingo
Commit-ID: b14ffaca44c60da1c900aa36131ef3d9858001fc
Gitweb: http://git.kernel.org/tip/b14ffaca44c60da1c900aa36131ef3d9858001fc
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Fri, 16 Mar 2012 17:50:54 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2012 16:41:30 -0300
perf report: Add --symbol-filter option
Add new --symbol-filter command line option to set appropriate filter
string.
Its short version is missing as I couldn't find an ideal one and
--filter option of perf record also has no short version.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1331887855-874-4-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8e91c6e..80fb907 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -50,6 +50,7 @@ struct perf_report {
const char *pretty_printing_style;
symbol_filter_t annotate_init;
const char *cpu_list;
+ const char *symbol_filter_str;
DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
};
@@ -400,6 +401,9 @@ static int __cmd_report(struct perf_report *rep)
list_for_each_entry(pos, &session->evlist->entries, node) {
struct hists *hists = &pos->hists;
+ if (pos->idx == 0)
+ hists->symbol_filter_str = rep->symbol_filter_str;
+
hists__collapse_resort(hists);
hists__output_resort(hists);
nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
@@ -591,6 +595,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
"only consider symbols in these comms"),
OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
"only consider these symbols"),
+ OPT_STRING(0, "symbol-filter", &report.symbol_filter_str, "filter",
+ "only show symbols that (partially) match with this filter"),
OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
"width[,width...]",
"don't try to adjust column width, use these fixed values"),
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf report: Treat an argument as a symbol filter
2012-03-16 8:50 ` [PATCH v2 5/5] perf report: Treat an argument as a symbol filter Namhyung Kim
@ 2012-03-19 20:05 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:05 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx, mingo
Commit-ID: 6db6127c4dad634ab98709b81e2f2770890b0d53
Gitweb: http://git.kernel.org/tip/6db6127c4dad634ab98709b81e2f2770890b0d53
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Fri, 16 Mar 2012 17:50:55 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2012 16:44:36 -0300
perf report: Treat an argument as a symbol filter
As Ingo requested, it'd be better off treating first (and the only)
argument as a symbol filter, so that user doesn't need to input the
symbol on the dialog window on TUI.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1331887855-874-5-git-send-email-namhyung.kim@lge.com
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 80fb907..c005458 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -715,11 +715,16 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
} else
symbol_conf.exclude_other = false;
- /*
- * Any (unrecognized) arguments left?
- */
- if (argc)
- usage_with_options(report_usage, options);
+ if (argc) {
+ /*
+ * Special case: if there's an argument left then assume that
+ * it's a symbol filter:
+ */
+ if (argc > 1)
+ usage_with_options(report_usage, options);
+
+ report.symbol_filter_str = argv[0];
+ }
sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", stdout);
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf ui browser: Clean lines inside of the input window
2012-03-19 2:46 ` [PATCH] perf ui browser: Clean lines inside of the input window Namhyung Kim
@ 2012-03-19 20:06 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx
Commit-ID: f7e5410920fabadf294177f590b54ab0cadc4775
Gitweb: http://git.kernel.org/tip/f7e5410920fabadf294177f590b54ab0cadc4775
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Mon, 19 Mar 2012 11:46:20 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 19 Mar 2012 12:07:30 -0300
perf ui browser: Clean lines inside of the input window
As Arnaldo pointed out, it should be cleared to prevent the window from
displaying overlapped strings on the region.
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1332125180-23041-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/ui/util.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 360f43f..ad4374a 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -108,9 +108,13 @@ int ui_browser__input_window(const char *title, const char *text, char *input,
max_len -= 2;
SLsmg_write_wrapped_string((unsigned char *)text, y, x,
nr_lines, max_len, 1);
- y += nr_lines + 1;
- SLsmg_set_color(0);
- SLsmg_draw_box(y - 1, x + 1, 3, max_len - 2);
+ y += nr_lines;
+ len = 5;
+ while (len--) {
+ SLsmg_gotorc(y + len - 1, x);
+ SLsmg_write_nstring((char *)" ", max_len);
+ }
+ SLsmg_draw_box(y++, x + 1, 3, max_len - 2);
SLsmg_gotorc(y + 3, x);
SLsmg_write_nstring((char *)exit_msg, max_len);
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf report: Document --symbol-filter option
2012-03-19 2:53 ` [PATCH] perf report: Document " Namhyung Kim
@ 2012-03-19 20:07 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-03-19 20:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra,
namhyung.kim, namhyung, tglx
Commit-ID: fde0eeaba7fe18dfd2ee6142fb562123e510ef84
Gitweb: http://git.kernel.org/tip/fde0eeaba7fe18dfd2ee6142fb562123e510ef84
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Mon, 19 Mar 2012 11:53:48 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 19 Mar 2012 12:13:56 -0300
perf report: Document --symbol-filter option
Add missing description of --symbol-filter in Documentation/perf-report.txt.
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1332125628-23088-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 87feeee..68bbf9c 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -48,6 +48,9 @@ OPTIONS
Only consider these symbols. CSV that understands
file://filename entries.
+--symbol-filter=::
+ Only show symbols that match (partially) with this filter.
+
-U::
--hide-unresolved::
Only display entries resolved to a symbol.
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-03-19 20:07 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 8:50 [PATCH v2 1/5] perf hists: Add hists__filter_by_symbol Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 2/5] perf ui browser: Introduce ui_browser__input_window Namhyung Kim
2012-03-16 19:40 ` Arnaldo Carvalho de Melo
2012-03-19 2:46 ` [PATCH] perf ui browser: Clean lines inside of the input window Namhyung Kim
2012-03-19 20:06 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-03-19 20:03 ` [tip:perf/core] perf ui browser: Introduce ui_browser__input_window tip-bot for Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 3/5] perf ui browser: Add 's' key to filter by symbol name Namhyung Kim
2012-03-19 20:03 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 4/5] perf report: Add --symbol-filter option Namhyung Kim
2012-03-16 19:42 ` Arnaldo Carvalho de Melo
2012-03-19 2:53 ` [PATCH] perf report: Document " Namhyung Kim
2012-03-19 20:07 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-03-19 20:04 ` [tip:perf/core] perf report: Add " tip-bot for Namhyung Kim
2012-03-16 8:50 ` [PATCH v2 5/5] perf report: Treat an argument as a symbol filter Namhyung Kim
2012-03-19 20:05 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-03-19 20:02 ` [tip:perf/core] perf hists: Add hists__filter_by_symbol tip-bot for Namhyung Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.