char *termtype;
WINDOW *footer, *header, *center, *status;
-WINDOW *perf_panel_window = NULL;
-PANEL *perf_panel, *main_panel;
+WINDOW *pref_panel_window = NULL;
+PANEL *pref_panel, *main_panel;
-int perf_panel_visible = 0;
+int pref_panel_visible = 0;
int perf_line_selected = 0;
int last_display_index, currently_displayed_index;
mvwprintw(center, 1, 22, "NAME");
perf_row = 40;
- g_hash_table_iter_init(&iter, data->perf_list);
+ g_hash_table_iter_init(&iter, global_perf_liszt);
while (g_hash_table_iter_next (&iter, &key, (gpointer) &perfn1)) {
if (perfn1->visible) {
/* + 5 to strip the "perf_" prefix */
mvwprintw(center, current_line + header_offset, 11, "%d", tmp->tid);
mvwprintw(center, current_line + header_offset, 22, "%s", tmp->comm);
- g_hash_table_iter_init(&iter, data->perf_list);
+ g_hash_table_iter_init(&iter, global_perf_liszt);
perf_row = 40;
while (g_hash_table_iter_next (&iter, &key, (gpointer) &perfn1)) {
sem_post(&update_display_sem);
}
-void setup_perf_panel()
+void setup_pref_panel()
{
int size;
if (!data)
return;
- if (perf_panel_window) {
- del_panel(perf_panel);
- delwin(perf_panel_window);
+ if (pref_panel_window) {
+ del_panel(pref_panel);
+ delwin(pref_panel_window);
}
- size = g_hash_table_size(data->perf_list);
- perf_panel_window = create_window(size + 2, 30, 10, 10);
- perf_panel = new_panel(perf_panel_window);
- perf_panel_visible = 0;
- hide_panel(perf_panel);
+ size = g_hash_table_size(global_perf_liszt);
+ pref_panel_window = create_window(size + 2, 30, 10, 10);
+ pref_panel = new_panel(pref_panel_window);
+ pref_panel_visible = 0;
+ hide_panel(pref_panel);
}
void update_perf_panel(int line_selected, int toggle_view, int toggle_sort)
if (!data)
return;
- werase(perf_panel_window);
- box(perf_panel_window, 0 , 0);
- set_window_title(perf_panel_window, "Perf Preferences ");
- wattron(perf_panel_window, A_BOLD);
- mvwprintw(perf_panel_window, g_hash_table_size(data->perf_list) + 1, 1,
+ werase(pref_panel_window);
+ box(pref_panel_window, 0 , 0);
+ set_window_title(pref_panel_window, "Perf Preferences ");
+ wattron(pref_panel_window, A_BOLD);
+ mvwprintw(pref_panel_window, g_hash_table_size(global_perf_liszt) + 1, 1,
" 's' to sort");
- wattroff(perf_panel_window, A_BOLD);
+ wattroff(pref_panel_window, A_BOLD);
if (toggle_sort == 1) {
i = 0;
- perflist = g_list_first(g_hash_table_get_keys(data->perf_list));
+ perflist = g_list_first(g_hash_table_get_keys(global_perf_liszt));
while (perflist) {
- perf = g_hash_table_lookup(data->perf_list, perflist->data);
+ perf = g_hash_table_lookup(global_perf_liszt, perflist->data);
if (i != line_selected)
perf->sort = 0;
else
}
i = 0;
- perflist = g_list_first(g_hash_table_get_keys(data->perf_list));
+ perflist = g_list_first(g_hash_table_get_keys(global_perf_liszt));
while (perflist) {
- perf = g_hash_table_lookup(data->perf_list, perflist->data);
+ perf = g_hash_table_lookup(global_perf_liszt, perflist->data);
if (i == line_selected && toggle_view == 1) {
perf->visible = perf->visible == 1 ? 0:1;
update_current_view();
}
if (i == line_selected) {
- wattron(perf_panel_window, COLOR_PAIR(5));
- mvwhline(perf_panel_window, i + 1, 1, ' ', 30 - 2);
+ wattron(pref_panel_window, COLOR_PAIR(5));
+ mvwhline(pref_panel_window, i + 1, 1, ' ', 30 - 2);
}
if (perf->sort == 1)
- wattron(perf_panel_window, A_BOLD);
- mvwprintw(perf_panel_window, i + 1, 1, "[%c] %s",
+ wattron(pref_panel_window, A_BOLD);
+ mvwprintw(pref_panel_window, i + 1, 1, "[%c] %s",
perf->visible == 1 ? 'x' : ' ',
(char *) perflist->data + 5);
- wattroff(perf_panel_window, A_BOLD);
- wattroff(perf_panel_window, COLOR_PAIR(5));
+ wattroff(pref_panel_window, A_BOLD);
+ wattroff(pref_panel_window, COLOR_PAIR(5));
i++;
perflist = g_list_next(perflist);
}
doupdate();
}
-void toggle_perf_panel(void)
+void update_preference_panel(int line_selected, int toggle_view, int toggle_sort)
{
- if (perf_panel_visible) {
- hide_panel(perf_panel);
- perf_panel_visible = 0;
+ switch(current_view) {
+ case perf:
+ update_perf_panel(line_selected, toggle_view, toggle_sort);
+ break;
+ default:
+ break;
+ }
+}
+
+void toggle_pref_panel(void)
+{
+ if (pref_panel_visible) {
+ hide_panel(pref_panel);
+ pref_panel_visible = 0;
} else {
- setup_perf_panel();
- update_perf_panel(perf_line_selected, 0, 0);
- show_panel(perf_panel);
- perf_panel_visible = 1;
+ setup_pref_panel();
+ update_preference_panel(perf_line_selected, 0, 0);
+ show_panel(pref_panel);
+ pref_panel_visible = 1;
}
update_panels();
doupdate();
switch(ch) {
/* Move the cursor and scroll */
case KEY_DOWN:
- if (perf_panel_visible) {
- if (perf_line_selected < g_hash_table_size(data->perf_list) - 1)
+ if (pref_panel_visible) {
+ if (perf_line_selected < g_hash_table_size(global_perf_liszt) - 1)
perf_line_selected++;
- update_perf_panel(perf_line_selected, 0, 0);
+ update_preference_panel(perf_line_selected, 0, 0);
} else {
if (selected_line < (max_center_lines - 1) &&
selected_line < max_elements - 1) {
case KEY_NPAGE:
break;
case KEY_UP:
- if (perf_panel_visible) {
+ if (pref_panel_visible) {
if (perf_line_selected > 0)
perf_line_selected--;
- update_perf_panel(perf_line_selected, 0, 0);
+ update_preference_panel(perf_line_selected, 0, 0);
} else {
if (selected_line > 0) {
selected_line--;
break;
case ' ':
- if (perf_panel_visible) {
- update_perf_panel(perf_line_selected, 1, 0);
+ if (pref_panel_visible) {
+ update_preference_panel(perf_line_selected, 1, 0);
} else {
update_selected_processes();
update_current_view();
}
break;
case 's':
- if (perf_panel_visible)
- update_perf_panel(perf_line_selected, 0, 1);
+ if (pref_panel_visible)
+ update_preference_panel(perf_line_selected, 0, 1);
break;
case 13: /* FIXME : KEY_ENTER ?? */
}
break;
case 'P':
- toggle_perf_panel();
+ toggle_pref_panel();
break;
default:
if (data)
print_log("Starting display");
main_panel = new_panel(center);
- setup_perf_panel();
+ setup_pref_panel();
current_view = cpu;
pthread_create(&keyboard_thread, NULL, handle_keyboard, (void *)NULL);
}
-