void ilka_prof_dump() { struct ilka_prof *p = prof_roots; while (p) { prof_print(p->title, p->hits, 1, p->elapsed, 1.0, ""); for (size_t i = 0; i < ilka_prof_max_children; ++i) { if (!p->children[i].p) continue; size_t hits = p->children[i].hits; uint64_t elapsed = p->children[i].elapsed; prof_print(p->children[i].p->title, hits, hits / p->hits, elapsed, (double) elapsed / p->elapsed, " "); } p = p->next; } }
static void handle_key_release(int keycode) { // static long idx_article = 0; static int first_time_random = 0; int mode; finger_move_speed = 0; keyboard_key_reset_invert(KEYBOARD_RESET_INVERT_NOW); // reset invert immediately DP(DBG_WL, ("O handle_key_release()\n")); mode = keyboard_get_mode(); if (keycode == WL_INPUT_KEY_POWER) { #ifdef INCLUDED_FROM_KERNEL if (history_list_save(HISTORY_SAVE_POWER_OFF)) { delay_us(200000); } #endif } else if (keycode == WL_INPUT_KEY_SEARCH) { article_buf_pointer = NULL; /* back to search */ if (display_mode == DISPLAY_MODE_INDEX) { toggle_soft_keyboard(); } else { search_set_selection(-1); display_mode = DISPLAY_MODE_INDEX; keyboard_set_mode(KEYBOARD_CHAR); repaint_search(); } } else if (keycode == WL_INPUT_KEY_HISTORY) { if (display_mode != DISPLAY_MODE_HISTORY) { article_buf_pointer = NULL; history_reload(); display_mode = DISPLAY_MODE_HISTORY; keyboard_set_mode(KEYBOARD_NONE); } else { if (keyboard_get_mode() == KEYBOARD_CLEAR_HISTORY) { keyboard_set_mode(KEYBOARD_NONE); guilib_fb_lock(); //keyboard_paint(); draw_clear_history(1); guilib_fb_unlock(); } else if (history_get_count() > 0) { keyboard_set_mode(KEYBOARD_CLEAR_HISTORY); guilib_fb_lock(); //keyboard_paint(); draw_clear_history(0); guilib_fb_unlock(); } } } else if (keycode == WL_INPUT_KEY_RANDOM) { if (first_time_random < 4) first_time_random++; if (first_time_random == 3) { first_time_random = 4; if (init_article_filter()) return; } article_buf_pointer = NULL; display_mode = DISPLAY_MODE_ARTICLE; last_display_mode = DISPLAY_MODE_INDEX; random_article(); } else if (display_mode == DISPLAY_MODE_INDEX) { article_buf_pointer = NULL; if (keycode == WL_KEY_RETURN) { int cur_selection = search_current_selection(); retrieve_article(cur_selection); #ifdef PROFILER_ON } else if (keycode == WL_KEY_HASH) { /* activate if you want to run performance tests */ /* perf_test(); */ malloc_status_simple(); prof_print(); #endif } else { handle_search_key(keycode); } } else if (display_mode == DISPLAY_MODE_ARTICLE) { article_buf_pointer = NULL; if (keycode == WL_KEY_BACKSPACE) { if (last_display_mode == DISPLAY_MODE_INDEX) { display_mode = DISPLAY_MODE_INDEX; repaint_search(); } else if (last_display_mode == DISPLAY_MODE_HISTORY) { display_mode = DISPLAY_MODE_HISTORY; history_reload(); } } } }