Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1354171 > unrolled thread
| Started by | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| First post | 2016-03-09 15:30 +0100 |
| Last post | 2016-03-11 10:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/3] perf tools: Add sort__has_comm variable Namhyung Kim <namhyung@kernel.org> - 2016-03-09 15:30 +0100
[PATCH 2/3] perf hists browser: Allow thread filtering for comm sort key Namhyung Kim <namhyung@kernel.org> - 2016-03-09 15:30 +0100
[tip:perf/core] perf tools: Add sort__has_comm variable tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-11 10:00 +0100
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-03-09 15:30 +0100 |
| Subject | [PATCH 1/3] perf tools: Add sort__has_comm variable |
| Message-ID | <raNhE-DP-7@gated-at.bofh.it> |
The sort__has_comm variable is to check whether the comm sort key is
given. This is necessary to support thread filtering in the TUI hists
browser later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/sort.c | 3 +++
tools/perf/util/sort.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 84c6654b4065..ca23b3ba0b2f 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -27,6 +27,7 @@ int sort__has_sym = 0;
int sort__has_dso = 0;
int sort__has_socket = 0;
int sort__has_thread = 0;
+int sort__has_comm = 0;
enum sort_mode sort__mode = SORT_MODE__NORMAL;
/*
@@ -2255,6 +2256,8 @@ static int sort_dimension__add(const char *tok, struct perf_evlist *evlist,
sort__has_socket = 1;
} else if (sd->entry == &sort_thread) {
sort__has_thread = 1;
+ } else if (sd->entry == &sort_comm) {
+ sort__has_comm = 1;
}
return __sort_dimension__add(sd, level);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 151afc1b6c2f..3f4e35998119 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -37,6 +37,7 @@ extern int sort__has_parent;
extern int sort__has_sym;
extern int sort__has_socket;
extern int sort__has_thread;
+extern int sort__has_comm;
extern enum sort_mode sort__mode;
extern struct sort_entry sort_comm;
extern struct sort_entry sort_dso;
--
2.7.2
[toc] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-03-09 15:30 +0100 |
| Subject | [PATCH 2/3] perf hists browser: Allow thread filtering for comm sort key |
| Message-ID | <raNhF-DP-19@gated-at.bofh.it> |
| In reply to | #1354171 |
The commit 2eafd410e669 ("perf hists browser: Only 'Zoom into thread'
only when sort order has 'pid'") disabled thread filtering in hist
browser for the default sort key. However the he->thread is still valid
even if 'pid' sort key is not given. Only thing it should not use is
the pid (or tid) of the thread. So allow to filter by thread when
'comm' sort key is given and show pid only if 'pid' sort key is given.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/browsers/hists.c | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index aed9c8f011f7..69b0d23ffaaa 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2136,11 +2136,17 @@ static int hists__browser_title(struct hists *hists,
if (hists->uid_filter_str)
printed += snprintf(bf + printed, size - printed,
", UID: %s", hists->uid_filter_str);
- if (thread)
- printed += scnprintf(bf + printed, size - printed,
+ if (thread) {
+ if (sort__has_thread)
+ printed += scnprintf(bf + printed, size - printed,
", Thread: %s(%d)",
(thread->comm_set ? thread__comm_str(thread) : ""),
thread->tid);
+ else
+ printed += scnprintf(bf + printed, size - printed,
+ ", Thread: %s",
+ (thread->comm_set ? thread__comm_str(thread) : ""));
+ }
if (dso)
printed += scnprintf(bf + printed, size - printed,
", DSO: %s", dso->short_name);
@@ -2321,9 +2327,14 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
thread__zput(browser->hists->thread_filter);
ui_helpline__pop();
} else {
- ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"",
- thread->comm_set ? thread__comm_str(thread) : "",
- thread->tid);
+ if (sort__has_thread)
+ ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"",
+ thread->comm_set ? thread__comm_str(thread) : "",
+ thread->tid);
+ else
+ ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s thread\"",
+ thread->comm_set ? thread__comm_str(thread) : "");
+
browser->hists->thread_filter = thread__get(thread);
perf_hpp__set_elide(HISTC_THREAD, false);
pstack__push(browser->pstack, &browser->hists->thread_filter);
@@ -2338,13 +2349,21 @@ static int
add_thread_opt(struct hist_browser *browser, struct popup_action *act,
char **optstr, struct thread *thread)
{
- if (!sort__has_thread || thread == NULL)
+ int ret;
+
+ if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
return 0;
- if (asprintf(optstr, "Zoom %s %s(%d) thread",
- browser->hists->thread_filter ? "out of" : "into",
- thread->comm_set ? thread__comm_str(thread) : "",
- thread->tid) < 0)
+ if (sort__has_thread)
+ ret = asprintf(optstr, "Zoom %s %s(%d) thread",
+ browser->hists->thread_filter ? "out of" : "into",
+ thread->comm_set ? thread__comm_str(thread) : "",
+ thread->tid);
+ else
+ ret = asprintf(optstr, "Zoom %s %s thread",
+ browser->hists->thread_filter ? "out of" : "into",
+ thread->comm_set ? thread__comm_str(thread) : "");
+ if (ret < 0)
return 0;
act->thread = thread;
--
2.7.2
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2016-03-11 10:00 +0100 |
| Subject | [tip:perf/core] perf tools: Add sort__has_comm variable |
| Message-ID | <rbr5o-3zy-5@gated-at.bofh.it> |
| In reply to | #1354171 |
Commit-ID: 078b8d4a406fa8ce4a3c9d5145c27be1ed2b1dfd
Gitweb: http://git.kernel.org/tip/078b8d4a406fa8ce4a3c9d5145c27be1ed2b1dfd
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Wed, 9 Mar 2016 23:20:51 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 10 Mar 2016 16:47:19 -0300
perf tools: Add sort__has_comm variable
The sort__has_comm variable is to check whether the comm sort key is
given. This is necessary to support thread filtering in the TUI hists
browser later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1457533253-21419-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/sort.c | 3 +++
tools/perf/util/sort.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index ced849e..93fa136 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -27,6 +27,7 @@ int sort__has_sym = 0;
int sort__has_dso = 0;
int sort__has_socket = 0;
int sort__has_thread = 0;
+int sort__has_comm = 0;
enum sort_mode sort__mode = SORT_MODE__NORMAL;
/*
@@ -2262,6 +2263,8 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
sort__has_socket = 1;
} else if (sd->entry == &sort_thread) {
sort__has_thread = 1;
+ } else if (sd->entry == &sort_comm) {
+ sort__has_comm = 1;
}
return __sort_dimension__add(sd, list, level);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 151afc1..3f4e359 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -37,6 +37,7 @@ extern int sort__has_parent;
extern int sort__has_sym;
extern int sort__has_socket;
extern int sort__has_thread;
+extern int sort__has_comm;
extern enum sort_mode sort__mode;
extern struct sort_entry sort_comm;
extern struct sort_entry sort_dso;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web