Let's see if responsiveness is still good using the full CRT_delay

in ncurses. CPU usage goes down noticeably.
(Also, add missing comma, sorry.)
This commit is contained in:
Hisham Muhammad 2015-02-04 11:41:18 -02:00
parent cfc773f7ee
commit 4a26ac05b0
2 changed files with 8 additions and 6 deletions

12
CRT.c
View File

@ -50,7 +50,7 @@ typedef enum ColorSchemes_ {
COLORSCHEME_BLACKONWHITE = 2, COLORSCHEME_BLACKONWHITE = 2,
COLORSCHEME_LIGHTTERMINAL = 3, COLORSCHEME_LIGHTTERMINAL = 3,
COLORSCHEME_MIDNIGHT = 4, COLORSCHEME_MIDNIGHT = 4,
COLORSCHEME_BLACKNIGHT = 5 COLORSCHEME_BLACKNIGHT = 5,
LAST_COLORSCHEME = 6, LAST_COLORSCHEME = 6,
} ColorSchemes; } ColorSchemes;
@ -144,7 +144,7 @@ const char **CRT_treeStr = CRT_treeStrAscii;
static bool CRT_hasColors; static bool CRT_hasColors;
static int CRT_delay = 0; int CRT_delay = 0;
bool CRT_utf8 = false; bool CRT_utf8 = false;
@ -189,9 +189,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[MEMORY_BUFFERS] = ColorPair(Blue,Black), [MEMORY_BUFFERS] = ColorPair(Blue,Black),
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black), [MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black),
[MEMORY_CACHE] = ColorPair(Yellow,Black), [MEMORY_CACHE] = ColorPair(Yellow,Black),
[LOAD_AVERAGE_FIFTEEN] = A_NORMAL, [LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan,Black),
[LOAD_AVERAGE_FIVE] = ColorPair(Cyan,Black), [LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan,Black),
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(Cyan,Black), [LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Black),
[LOAD] = A_BOLD, [LOAD] = A_BOLD,
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black), [HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
[CLOCK] = A_BOLD, [CLOCK] = A_BOLD,
@ -524,7 +524,7 @@ static void CRT_handleSIGTERM(int sgn) {
void CRT_init(int delay, int colorScheme) { void CRT_init(int delay, int colorScheme) {
initscr(); initscr();
noecho(); noecho();
CRT_delay = delay/2; CRT_delay = delay;
if (CRT_delay == 0) { if (CRT_delay == 0) {
CRT_delay = 1; CRT_delay = 1;
} }

2
CRT.h
View File

@ -116,6 +116,8 @@ extern const char *CRT_treeStrUtf8[TREE_STR_COUNT];
extern const char **CRT_treeStr; extern const char **CRT_treeStr;
extern int CRT_delay;
extern bool CRT_utf8; extern bool CRT_utf8;
int* CRT_colors; int* CRT_colors;