mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
perf hists browser: Allow thread filtering for comm sort key
The commit 2eafd410e6
("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>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1457536490-24084-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
078b8d4a40
commit
6962ccb37b
@ -2136,11 +2136,18 @@ static int hists__browser_title(struct hists *hists,
|
|||||||
if (hists->uid_filter_str)
|
if (hists->uid_filter_str)
|
||||||
printed += snprintf(bf + printed, size - printed,
|
printed += snprintf(bf + printed, size - printed,
|
||||||
", UID: %s", hists->uid_filter_str);
|
", UID: %s", hists->uid_filter_str);
|
||||||
if (thread)
|
if (thread) {
|
||||||
printed += scnprintf(bf + printed, size - printed,
|
if (sort__has_thread) {
|
||||||
|
printed += scnprintf(bf + printed, size - printed,
|
||||||
", Thread: %s(%d)",
|
", Thread: %s(%d)",
|
||||||
(thread->comm_set ? thread__comm_str(thread) : ""),
|
(thread->comm_set ? thread__comm_str(thread) : ""),
|
||||||
thread->tid);
|
thread->tid);
|
||||||
|
} else {
|
||||||
|
printed += scnprintf(bf + printed, size - printed,
|
||||||
|
", Thread: %s",
|
||||||
|
(thread->comm_set ? thread__comm_str(thread) : ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dso)
|
if (dso)
|
||||||
printed += scnprintf(bf + printed, size - printed,
|
printed += scnprintf(bf + printed, size - printed,
|
||||||
", DSO: %s", dso->short_name);
|
", DSO: %s", dso->short_name);
|
||||||
@ -2321,9 +2328,15 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
|
|||||||
thread__zput(browser->hists->thread_filter);
|
thread__zput(browser->hists->thread_filter);
|
||||||
ui_helpline__pop();
|
ui_helpline__pop();
|
||||||
} else {
|
} else {
|
||||||
ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"",
|
if (sort__has_thread) {
|
||||||
thread->comm_set ? thread__comm_str(thread) : "",
|
ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"",
|
||||||
thread->tid);
|
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);
|
browser->hists->thread_filter = thread__get(thread);
|
||||||
perf_hpp__set_elide(HISTC_THREAD, false);
|
perf_hpp__set_elide(HISTC_THREAD, false);
|
||||||
pstack__push(browser->pstack, &browser->hists->thread_filter);
|
pstack__push(browser->pstack, &browser->hists->thread_filter);
|
||||||
@ -2338,13 +2351,22 @@ static int
|
|||||||
add_thread_opt(struct hist_browser *browser, struct popup_action *act,
|
add_thread_opt(struct hist_browser *browser, struct popup_action *act,
|
||||||
char **optstr, struct thread *thread)
|
char **optstr, struct thread *thread)
|
||||||
{
|
{
|
||||||
if (!sort__has_thread || thread == NULL)
|
int ret;
|
||||||
|
|
||||||
|
if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (asprintf(optstr, "Zoom %s %s(%d) thread",
|
if (sort__has_thread) {
|
||||||
browser->hists->thread_filter ? "out of" : "into",
|
ret = asprintf(optstr, "Zoom %s %s(%d) thread",
|
||||||
thread->comm_set ? thread__comm_str(thread) : "",
|
browser->hists->thread_filter ? "out of" : "into",
|
||||||
thread->tid) < 0)
|
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;
|
return 0;
|
||||||
|
|
||||||
act->thread = thread;
|
act->thread = thread;
|
||||||
|
Loading…
Reference in New Issue
Block a user