From 04419c8cdf7a3ffcc2c7cccd00cde0916cce848f Mon Sep 17 00:00:00 2001 From: Gautier DI FOLCO Date: Tue, 7 Dec 2021 23:19:09 +0100 Subject: [PATCH 1/2] Progressive colors for CPU usage --- common/luts.h | 138 +++++++++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/common/luts.h b/common/luts.h index 0c99e08..81fc58c 100644 --- a/common/luts.h +++ b/common/luts.h @@ -5,8 +5,74 @@ static const char cpu_percentage_lut[][32] = { "#[fg=brightwhite,bg=colour16]", "#[fg=brightwhite,bg=colour16]", "#[fg=brightwhite,bg=colour16]", -"#[fg=brightwhite,bg=colour52]", -"#[fg=brightwhite,bg=colour52]", +"#[fg=brightwhite,bg=colour16]", +"#[fg=brightwhite,bg=colour16]", +"#[fg=brightwhite,bg=colour16]", +"#[fg=brightwhite,bg=colour16]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour17]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour18]", +"#[fg=brightwhite,bg=colour19]", +"#[fg=brightwhite,bg=colour19]", +"#[fg=brightwhite,bg=colour19]", +"#[fg=brightwhite,bg=colour19]", +"#[fg=brightwhite,bg=colour19]", +"#[fg=brightwhite,bg=colour19]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour20]", +"#[fg=brightwhite,bg=colour21]", +"#[fg=brightwhite,bg=colour21]", +"#[fg=brightwhite,bg=colour21]", +"#[fg=brightwhite,bg=colour21]", +"#[fg=brightwhite,bg=colour21]", +"#[fg=brightwhite,bg=colour21]", +"#[fg=brightwhite,bg=colour57]", +"#[fg=brightwhite,bg=colour57]", +"#[fg=brightwhite,bg=colour57]", +"#[fg=brightwhite,bg=colour57]", +"#[fg=brightwhite,bg=colour57]", +"#[fg=brightwhite,bg=colour57]", +"#[fg=brightwhite,bg=colour56]", +"#[fg=brightwhite,bg=colour56]", +"#[fg=brightwhite,bg=colour56]", +"#[fg=brightwhite,bg=colour56]", +"#[fg=brightwhite,bg=colour56]", +"#[fg=brightwhite,bg=colour56]", +"#[fg=brightwhite,bg=colour55]", +"#[fg=brightwhite,bg=colour55]", +"#[fg=brightwhite,bg=colour55]", +"#[fg=brightwhite,bg=colour55]", +"#[fg=brightwhite,bg=colour55]", +"#[fg=brightwhite,bg=colour55]", +"#[fg=brightwhite,bg=colour54]", +"#[fg=brightwhite,bg=colour54]", +"#[fg=brightwhite,bg=colour54]", +"#[fg=brightwhite,bg=colour54]", +"#[fg=brightwhite,bg=colour54]", +"#[fg=brightwhite,bg=colour54]", +"#[fg=brightwhite,bg=colour53]", +"#[fg=brightwhite,bg=colour53]", +"#[fg=brightwhite,bg=colour53]", +"#[fg=brightwhite,bg=colour53]", +"#[fg=brightwhite,bg=colour53]", +"#[fg=brightwhite,bg=colour53]", "#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour52]", @@ -19,16 +85,12 @@ static const char cpu_percentage_lut[][32] = { "#[fg=brightwhite,bg=colour88]", "#[fg=brightwhite,bg=colour88]", "#[fg=brightwhite,bg=colour88]", -"#[fg=brightwhite,bg=colour88]", "#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]", -"#[fg=brightwhite,bg=colour124]", -"#[fg=brightwhite,bg=colour160]", -"#[fg=brightwhite,bg=colour160]", "#[fg=brightwhite,bg=colour160]", "#[fg=brightwhite,bg=colour160]", "#[fg=brightwhite,bg=colour160]", @@ -40,69 +102,7 @@ static const char cpu_percentage_lut[][32] = { "#[fg=brightwhite,bg=colour196]", "#[fg=brightwhite,bg=colour196]", "#[fg=brightwhite,bg=colour196]", -"#[fg=brightwhite,bg=colour196]", -"#[fg=brightwhite,bg=colour196]", -"#[fg=brightwhite,bg=colour196]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour202]", -"#[fg=brightwhite,bg=colour208]", -"#[fg=black,bg=colour208]", -"#[fg=black,bg=colour208]", -"#[fg=black,bg=colour208]", -"#[fg=black,bg=colour208]", -"#[fg=black,bg=colour208]", -"#[fg=black,bg=colour208]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour214]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour220]", -"#[fg=black,bg=colour226]", -"#[fg=black,bg=colour226]", -"#[fg=black,bg=colour226]", -"#[fg=black,bg=colour226]", -"#[fg=black,bg=colour226]", -"#[fg=black,bg=colour226]", -"#[fg=black,bg=colour227]", -"#[fg=black,bg=colour227]", -"#[fg=black,bg=colour227]", -"#[fg=black,bg=colour227]", -"#[fg=black,bg=colour227]", -"#[fg=black,bg=colour227]", -"#[fg=black,bg=colour228]", -"#[fg=black,bg=colour228]", -"#[fg=black,bg=colour228]", -"#[fg=black,bg=colour228]", -"#[fg=black,bg=colour228]", -"#[fg=black,bg=colour229]", -"#[fg=black,bg=colour229]", -"#[fg=black,bg=colour229]", -"#[fg=black,bg=colour229]", -"#[fg=black,bg=colour229]", -"#[fg=black,bg=colour230]", -"#[fg=black,bg=colour230]", -"#[fg=black,bg=colour230]", -"#[fg=black,bg=colour230]", -"#[fg=black,bg=colour230]", -"#[fg=black,bg=colour231]", -"#[fg=black,bg=colour231]", -"#[fg=black,bg=colour231]" +"#[fg=brightwhite,bg=colour196]" }; // end cpu_percentage_lut static const char mem_lut[][32] = { From 1ac6729ef1142c79a98238d24ec98cba12188620 Mon Sep 17 00:00:00 2001 From: Gautier DI FOLCO Date: Tue, 7 Dec 2021 23:19:49 +0100 Subject: [PATCH 2/2] Less sensitive memory default thresholds --- common/memory.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/memory.cc b/common/memory.cc index 423e6b2..6e09f84 100644 --- a/common/memory.cc +++ b/common/memory.cc @@ -84,9 +84,12 @@ std::string mem_string( const MemoryStatus & mem_status, break; } default: // Default mode, just show the used/total memory in MB - if(mem_status.used_mem>100000 && mem_status.total_mem>100000) oss<(mem_status.used_mem/1024)<<"/"<(mem_status.total_mem/1024)<<"GB"; - else if(mem_status.used_mem<100000 && mem_status.total_mem>100000) oss<(mem_status.used_mem)<<"MB/"<(mem_status.total_mem/1024)<<"GB"; - else oss<(mem_status.used_mem)<<"/"<(mem_status.total_mem)<<"MB"; + if(mem_status.used_mem>10000 && mem_status.total_mem>10000) + oss<(mem_status.used_mem/1024)<<"/"<(mem_status.total_mem/1024)<<"GB"; + else if(mem_status.used_mem<10000 && mem_status.total_mem>10000) + oss<(mem_status.used_mem)<<"MB/"<(mem_status.total_mem/1024)<<"GB"; + else + oss<(mem_status.used_mem)<<"/"<(mem_status.total_mem)<<"MB"; } if( use_colors )