spdk_top: add menu to core details window for displaying thread details
Adds menu to core details pop-up window to allow selecting threads running on core. Pressing ENTER on selected thread shows pop-up window with thread details. Added function to display thread details in pop-up window to avoid code duplication. Function is called when ENTER is pressed on a selected thread in THREADS tab and inside cores pop-up window. Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Change-Id: I62a6de15c4bb4b58da0a7436d74cd20e0544a2ae Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5548 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Maciej Szwed <maciej.szwed@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
bd3c084fc7
commit
0aced70043
@ -859,7 +859,7 @@ refresh_threads_tab(uint8_t current_page)
|
|||||||
{
|
{
|
||||||
struct col_desc *col_desc = g_col_desc[THREADS_TAB];
|
struct col_desc *col_desc = g_col_desc[THREADS_TAB];
|
||||||
uint64_t i, threads_count;
|
uint64_t i, threads_count;
|
||||||
uint16_t j;
|
uint16_t j, k;
|
||||||
uint16_t col;
|
uint16_t col;
|
||||||
uint8_t max_pages, item_index;
|
uint8_t max_pages, item_index;
|
||||||
static uint8_t last_page = 0;
|
static uint8_t last_page = 0;
|
||||||
@ -899,6 +899,11 @@ refresh_threads_tab(uint8_t current_page)
|
|||||||
|
|
||||||
qsort(thread_info, threads_count, sizeof(thread_info[0]), sort_threads);
|
qsort(thread_info, threads_count, sizeof(thread_info[0]), sort_threads);
|
||||||
|
|
||||||
|
for (k = 0; k < threads_count; k++) {
|
||||||
|
g_thread_history[thread_info[k]->id].busy = thread_info[k]->busy - thread_info[k]->last_busy;
|
||||||
|
g_thread_history[thread_info[k]->id].idle = thread_info[k]->idle - thread_info[k]->last_idle;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = current_page * g_max_data_rows;
|
for (i = current_page * g_max_data_rows;
|
||||||
i < spdk_min(threads_count, (uint64_t)((current_page + 1) * g_max_data_rows));
|
i < spdk_min(threads_count, (uint64_t)((current_page + 1) * g_max_data_rows));
|
||||||
i++) {
|
i++) {
|
||||||
@ -952,7 +957,6 @@ refresh_threads_tab(uint8_t current_page)
|
|||||||
print_max_len(g_tabs[THREADS_TAB], TABS_DATA_START_ROW + item_index, col,
|
print_max_len(g_tabs[THREADS_TAB], TABS_DATA_START_ROW + item_index, col,
|
||||||
col_desc[5].max_data_string, ALIGN_RIGHT, idle_time);
|
col_desc[5].max_data_string, ALIGN_RIGHT, idle_time);
|
||||||
col += col_desc[5].max_data_string;
|
col += col_desc[5].max_data_string;
|
||||||
thread_info[i]->last_idle = thread_info[i]->idle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_thread_history[thread_info[i]->id].busy = thread_info[i]->busy - thread_info[i]->last_busy;
|
g_thread_history[thread_info[i]->id].busy = thread_info[i]->busy - thread_info[i]->last_busy;
|
||||||
@ -964,7 +968,6 @@ refresh_threads_tab(uint8_t current_page)
|
|||||||
}
|
}
|
||||||
print_max_len(g_tabs[THREADS_TAB], TABS_DATA_START_ROW + item_index, col,
|
print_max_len(g_tabs[THREADS_TAB], TABS_DATA_START_ROW + item_index, col,
|
||||||
col_desc[6].max_data_string, ALIGN_RIGHT, busy_time);
|
col_desc[6].max_data_string, ALIGN_RIGHT, busy_time);
|
||||||
thread_info[i]->last_busy = thread_info[i]->busy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item_index == g_selected_row) {
|
if (item_index == g_selected_row) {
|
||||||
@ -972,6 +975,11 @@ refresh_threads_tab(uint8_t current_page)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (k = 0; k < threads_count; k++) {
|
||||||
|
thread_info[k]->last_idle = thread_info[k]->idle;
|
||||||
|
thread_info[k]->last_busy = thread_info[k]->busy;
|
||||||
|
}
|
||||||
|
|
||||||
g_max_selected_row = i - current_page * g_max_data_rows - 1;
|
g_max_selected_row = i - current_page * g_max_data_rows - 1;
|
||||||
|
|
||||||
return max_pages;
|
return max_pages;
|
||||||
@ -2029,6 +2037,19 @@ show_thread(uint8_t current_page)
|
|||||||
free_data();
|
free_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
show_single_thread(uint64_t thread_id)
|
||||||
|
{
|
||||||
|
uint64_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < g_threads_stats.threads.threads_count; i++) {
|
||||||
|
if (g_threads_stats.threads.thread_info[i].id == thread_id) {
|
||||||
|
display_thread(&g_threads_stats.threads.thread_info[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_core(uint8_t current_page)
|
show_core(uint8_t current_page)
|
||||||
{
|
{
|
||||||
@ -2037,6 +2058,7 @@ show_core(uint8_t current_page)
|
|||||||
uint64_t core_number = current_page * g_max_data_rows + g_selected_row;
|
uint64_t core_number = current_page * g_max_data_rows + g_selected_row;
|
||||||
struct rpc_core_info *core_info[g_cores_stats.cores.cores_count];
|
struct rpc_core_info *core_info[g_cores_stats.cores.cores_count];
|
||||||
uint64_t threads_count, i, j;
|
uint64_t threads_count, i, j;
|
||||||
|
uint16_t current_threads_row;
|
||||||
int c;
|
int c;
|
||||||
char core_win_title[25];
|
char core_win_title[25];
|
||||||
bool stop_loop = false;
|
bool stop_loop = false;
|
||||||
@ -2097,13 +2119,38 @@ show_core(uint8_t current_page)
|
|||||||
refresh();
|
refresh();
|
||||||
wrefresh(core_win);
|
wrefresh(core_win);
|
||||||
|
|
||||||
|
current_threads_row = 0;
|
||||||
|
|
||||||
while (!stop_loop) {
|
while (!stop_loop) {
|
||||||
|
for (j = 0; j < core_info[core_number]->threads.threads_count; j++) {
|
||||||
|
if (j != current_threads_row) {
|
||||||
|
mvwprintw(core_win, j + 8, 1, core_info[core_number]->threads.thread[j].name);
|
||||||
|
} else {
|
||||||
|
print_left(core_win, j + 8, 1, CORE_WIN_WIDTH - 2,
|
||||||
|
core_info[core_number]->threads.thread[j].name, COLOR_PAIR(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wrefresh(core_win);
|
||||||
|
|
||||||
c = wgetch(core_win);
|
c = wgetch(core_win);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 10: /* ENTER */
|
case 10: /* ENTER */
|
||||||
|
show_single_thread(core_info[core_number]->threads.thread[current_threads_row].id);
|
||||||
|
break;
|
||||||
case 27: /* ESC */
|
case 27: /* ESC */
|
||||||
stop_loop = true;
|
stop_loop = true;
|
||||||
break;
|
break;
|
||||||
|
case KEY_UP:
|
||||||
|
if (current_threads_row != 0) {
|
||||||
|
current_threads_row--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_DOWN:
|
||||||
|
if (current_threads_row != core_info[core_number]->threads.threads_count - 1) {
|
||||||
|
current_threads_row++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user