No need to call wclear (werase) each time cursor changes position. In fact the
only time we
should call it - is when list of tunables changed. Currently this only happens
in
tuning_window::window_refresh() (on demand refresh patch should be applied).
werase is pretty heavy one:
--------------------------------------------------------------------------------
Ir I1mr ILmr Dr D1mr DLmr
Dw D1mw DLmw
--------------------------------------------------------------------------------
6,063,980,625 4,576,152 528,296 1,171,079,184 24,168,794 9,215,210
1,671,009,969 163,157,846 156,567,867 PROGRAM TOTALS
--------------------------------------------------------------------------------
Ir I1mr ILmr Dr D1mr DLmr Dw
D1mw DLmw file:function
--------------------------------------------------------------------------------
2,473,412,796 1,614 1,614 2,059,521 305,390 288,823 1,233,825,699
154,029,227 149,960,220 ???:werase
1,275,578,408 1,729,350 186,344 444,430,171 9,904,892 4,744,532 105,767,262
1,303,516 1,116,551 ???:???
173,032,557 22,395 812 24,595,485 9,095 421 857,262
1,957 391 ???:__strcat_chk
171,612,271 6,320 6,272 76,126,117 3,591,263 1,106,758 14,412,255
6,389 0 ???:pnoutrefresh
147,832,538 20 14 63,356,802 6,003,780 1,538,504 10,559,467
0 0 [...] event_sort_function(void*, void*)
[..]
Introduce static bool flag to mark the need of werase call in
__tuning_update_display.
Signed-off-by: Sergey Senozhatsky <[email protected]>
---
diff --git a/tuning/tuning.cpp b/tuning/tuning.cpp
index a87a746..d4305f5 100644
--- a/tuning/tuning.cpp
+++ b/tuning/tuning.cpp
@@ -43,7 +43,7 @@
#include "../lib.h"
static void sort_tunables(void);
-
+static bool should_clear = FALSE;
class tuning_window: public tab_window {
public:
@@ -90,13 +90,15 @@ static void __tuning_update_display(int cursor_pos)
WINDOW *win;
unsigned int i;
-
win = get_ncurses_win("Tunables");
if (!win)
return;
- wclear(win);
+ if (should_clear) {
+ should_clear = FALSE;
+ wclear(win);
+ }
wmove(win, 2,0);
@@ -163,6 +165,7 @@ void tuning_window::window_refresh()
}
all_untunables.clear();
+ should_clear = TRUE;
__init_tunables();
}
_______________________________________________
Discuss mailing list
[email protected]
http://lists.lesswatts.org/listinfo/discuss