X-Git-Url: https://git.lttng.org/?p=lttngtop.git;a=blobdiff_plain;f=src%2Fcursesdisplay.c;h=4cc97301648296a95c2ad625dded42d02e7aefe0;hp=62c4ba44e31c55288b03e05069f5450216a8ce5f;hb=f16e36fc0e460e58e327de6baaec29e90c3e3c93;hpb=1402044a1577c9b62b60f64fdb48ae9524be458c diff --git a/src/cursesdisplay.c b/src/cursesdisplay.c index 62c4ba4..4cc9730 100644 --- a/src/cursesdisplay.c +++ b/src/cursesdisplay.c @@ -70,6 +70,7 @@ pthread_t keyboard_thread; struct header_view cputopview[6]; struct header_view iostreamtopview[3]; struct header_view fileview[3]; +struct header_view kprobeview[2]; void reset_ncurses() { @@ -520,6 +521,39 @@ gint sort_by_cpu_group_by_threads_desc(gconstpointer p1, gconstpointer p2) return -1; } +void update_kprobes_display() +{ + int i, column; + struct kprobes *probe; + int header_offset = 2; + int current_line = 0; + + set_window_title(center, "Kprobes Top "); + wattron(center, A_BOLD); + column = 1; + for (i = 0; i < 2; i++) { + if (kprobeview[i].sort) { + wattron(center, A_UNDERLINE); + pref_current_sort = i; + } + mvwprintw(center, 1, column, "%s", kprobeview[i].title); + wattroff(center, A_UNDERLINE); + column += 30; + } + wattroff(center, A_BOLD); + + for (i = 0; i < data->kprobes_table->len; i++) { + column = 1; + probe = g_ptr_array_index(data->kprobes_table, i); + mvwprintw(center, current_line + header_offset, column, + "%s", probe->probe_name + 6); + column += 30; + mvwprintw(center, current_line + header_offset, column, + "%d", probe->count); + current_line++; + } +} + void update_cputop_display() { int i; @@ -570,6 +604,14 @@ void update_cputop_display() nblinedisplayed < max_center_lines; i++) { tmp = g_ptr_array_index(data->process_table, i); current_row_offset = 1; + if (!opt_tid && (opt_hostname && !lookup_hostname_list(tmp->hostname))) + continue; + if (!opt_hostname && (opt_tid && !lookup_tid_list(tmp->pid))) + continue; + if ((opt_tid && !lookup_tid_list(tmp->tid)) && + (opt_hostname && !lookup_hostname_list(tmp->hostname))) + continue; + if (tmp->pid != tmp->tid) if (toggle_threads == -1) continue; @@ -819,6 +861,15 @@ 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 (!opt_tid && (opt_hostname && !lookup_hostname_list(tmp->hostname))) + continue; + if (!opt_hostname && (opt_tid && !lookup_tid_list(tmp->pid))) + continue; + if ((opt_tid && !lookup_tid_list(tmp->tid)) && + (opt_hostname && !lookup_hostname_list(tmp->hostname))) + continue; + if (tmp->pid != tmp->tid) if (toggle_threads == -1) continue; @@ -901,6 +952,15 @@ 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 (!opt_tid && (opt_hostname && !lookup_hostname_list(tmp->hostname))) + continue; + if (!opt_hostname && (opt_tid && !lookup_tid_list(tmp->pid))) + continue; + if ((opt_tid && !lookup_tid_list(tmp->tid)) && + (opt_hostname && !lookup_hostname_list(tmp->hostname))) + continue; + if (tmp->pid != tmp->tid) if (toggle_threads == -1) continue; @@ -967,6 +1027,9 @@ void update_current_view() case tree: update_cputop_display(); break; + case kprobes: + update_kprobes_display(); + break; default: break; } @@ -1525,6 +1588,13 @@ void *handle_keyboard(void *p) selected_line = 0; update_current_view(); break; + case KEY_F(5): + if (pref_panel_visible) + toggle_pref_panel(); + current_view = kprobes; + selected_line = 0; + update_current_view(); + break; case KEY_F(10): case 'q': reset_ncurses(); @@ -1588,6 +1658,10 @@ void init_view_headers() fileview[1].title = strdup("READ"); fileview[1].sort = 1; fileview[2].title = strdup("WRITE"); + + kprobeview[0].title = strdup("NAME"); + kprobeview[1].title = strdup("HIT"); + kprobeview[1].sort = 1; } void init_ncurses()