From e15ed00a84c8afc3a4cee38b2a96128c313b9d13 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Thu, 26 Apr 2012 15:33:12 -0400 Subject: [PATCH 1/1] allow to hide threads Signed-off-by: Julien Desfossez --- doc/lttngtop.1 | 3 +++ src/cursesdisplay.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/lttngtop.1 b/doc/lttngtop.1 index 5f2ba35..83ad761 100644 --- a/doc/lttngtop.1 +++ b/doc/lttngtop.1 @@ -77,6 +77,9 @@ Highlights the process under the blue line to make it easy to find it across all \ \ \'\fBq\fR\': \fIQuit \fR Exit the program .TP 7 +\ \ \'\fBt\fR\': \fIThreads \fR +Toggle threads display in CPUTop +.TP 7 \ \ \'\fBr\fR\': \fIPreferences \fR Display the preference menu for the current view, this menu helps select the column displayed (only in PerfTop view for now) and the column to sort, use 's' to sort and 'space' to toggle the view .TP 7 diff --git a/src/cursesdisplay.c b/src/cursesdisplay.c index 77686ca..6ff650f 100644 --- a/src/cursesdisplay.c +++ b/src/cursesdisplay.c @@ -57,7 +57,7 @@ char log_lines[MAX_LINE_LENGTH * MAX_LOG_LINES + MAX_LOG_LINES]; int max_elements = 80; -int toggle_threads = -1; +int toggle_threads = 1; int toggle_pause = -1; int max_center_lines; @@ -281,6 +281,7 @@ void update_footer() print_key(footer, "Space", "Highlight ", 0); print_key(footer, "q", "Quit ", 0); print_key(footer, "r", "Pref ", 0); + print_key(footer, "t", "Threads ", toggle_threads); print_key(footer, "p", "Pause ", toggle_pause); wrefresh(footer); @@ -568,6 +569,9 @@ void update_cputop_display() for (i = list_offset; i < data->process_table->len && nblinedisplayed < max_center_lines; i++) { tmp = g_ptr_array_index(data->process_table, i); + if (tmp->pid != tmp->tid) + if (toggle_threads == -1) + continue; if (process_selected(tmp)) { wattron(center, COLOR_PAIR(6)); @@ -785,6 +789,9 @@ void update_perf() for (i = 0; i < data->process_table->len && nblinedisplayed < max_center_lines; i++) { tmp = g_ptr_array_index(data->process_table, i); + if (tmp->pid != tmp->tid) + if (toggle_threads == -1) + continue; if (process_selected(tmp)) { wattron(center, COLOR_PAIR(6)); @@ -862,6 +869,9 @@ void update_iostream() for (i = list_offset; i < data->process_table->len && nblinedisplayed < max_center_lines; i++) { tmp = g_ptr_array_index(data->process_table, i); + if (tmp->pid != tmp->tid) + if (toggle_threads == -1) + continue; if (process_selected(tmp)) { wattron(center, COLOR_PAIR(6)); -- 2.34.1