diff --git a/src/top/top.c b/src/top/top.c index f2145ecf..9cd6a962 100644 --- a/src/top/top.c +++ b/src/top/top.c @@ -2083,21 +2083,46 @@ static void adj_geometry (void) { if (Curwin->rc.double_up) { int num = (Curwin->rc.double_up + 1); int pfx = (Curwin->rc.double_up < 2) ? GRAPH_prefix_std : GRAPH_prefix_abv; + Graph_cpus->length = (Screen_cols - (ADJOIN_space * Curwin->rc.double_up) - (num * (pfx + GRAPH_suffix))) / num; - Graph_mems->length = (Screen_cols - ADJOIN_space - (2 * (GRAPH_prefix_std + GRAPH_suffix))) / 2; + if (Graph_cpus->length > GRAPH_length_max) Graph_cpus->length = GRAPH_length_max; + if (Graph_cpus->length < GRAPH_length_min) Graph_cpus->length = GRAPH_length_min; + + Graph_mems->length = (Screen_cols - ADJOIN_space - (2 * (pfx + GRAPH_suffix))) / 2; + if (Graph_mems->length > GRAPH_length_max) Graph_mems->length = GRAPH_length_max; + if (Graph_mems->length < GRAPH_length_min) Graph_mems->length = GRAPH_length_min; + +#if !defined(TOG4_MEM_FIX) && !defined(TOG4_MEM_1UP) + if (num > 2) { + #define cpuGRAPH ( GRAPH_prefix_abv + Graph_cpus->length + GRAPH_suffix ) + #define nxtGRAPH ( cpuGRAPH + ADJOIN_space ) + int len = cpuGRAPH; + for (;;) { + if (len + nxtGRAPH > GRAPH_length_max) break; + len += nxtGRAPH; + } + len -= (GRAPH_prefix_abv + ADJOIN_space); + Graph_mems->length = len; + #undef cpuGRAPH + #undef nxtGRAPH + } +#endif } else { Graph_cpus->length = Screen_cols - (GRAPH_prefix_std + GRAPH_length_max + GRAPH_suffix); if (Graph_cpus->length >= 0) Graph_cpus->length = GRAPH_length_max; else Graph_cpus->length = Screen_cols - GRAPH_prefix_std - GRAPH_suffix; + if (Graph_cpus->length < GRAPH_length_min) Graph_cpus->length = GRAPH_length_min; +#ifdef TOG4_MEM_1UP + Graph_mems->length = (Screen_cols - (GRAPH_prefix_std + GRAPH_suffix)); + if (Graph_mems->length > GRAPH_length_max) Graph_mems->length = GRAPH_length_max; + if (Graph_mems->length < GRAPH_length_min) Graph_mems->length = GRAPH_length_min; +#else Graph_mems->length = Graph_cpus->length; +#endif } - if (Graph_cpus->length < GRAPH_length_min) Graph_cpus->length = GRAPH_length_min; - if (Graph_cpus->length > GRAPH_length_max) Graph_cpus->length = GRAPH_length_max; Graph_cpus->adjust = (float)Graph_cpus->length / 100.0; Graph_cpus->style = Curwin->rc.graph_cpus; - if (Graph_mems->length < GRAPH_length_min) Graph_mems->length = GRAPH_length_min; - if (Graph_mems->length > GRAPH_length_max) Graph_mems->length = GRAPH_length_max; Graph_mems->adjust = (float)Graph_mems->length / 100.0; Graph_mems->style = Curwin->rc.graph_mems; @@ -6468,18 +6493,40 @@ static void do_memory (void) { Graph_mems->part1 = my_misc; Graph_mems->part2 = my_used; rx = sum_rx(Graph_mems); +#ifdef TOG4_MEM_1UP prT(bfT(0), mkM(MEM_VAL(mem_TOT))); snprintf(row, sizeof(row), "%s %s:~3%#5.1f~2/%-9.9s~3%s" , scT(label), N_txt(WORD_abv_mem_txt), rx->pcnt_tot, bfT(0), rx->graph); +#else + if (Curwin->rc.double_up > 1) + snprintf(row, sizeof(row), "%s %s~3%3.0f%s" + , scT(label), N_txt(WORD_abv_mem_txt), rx->pcnt_tot, rx->graph); + else { + prT(bfT(0), mkM(MEM_VAL(mem_TOT))); + snprintf(row, sizeof(row), "%s %s:~3%#5.1f~2/%-9.9s~3%s" + , scT(label), N_txt(WORD_abv_mem_txt), rx->pcnt_tot, bfT(0), rx->graph); + } +#endif Msg_row += sum_see(row, mem2UP); Graph_mems->total = MEM_VAL(swp_TOT); Graph_mems->part1 = 0; Graph_mems->part2 = MEM_VAL(swp_USE); rx = sum_rx(Graph_mems); +#ifdef TOG4_MEM_1UP prT(bfT(1), mkM(MEM_VAL(swp_TOT))); snprintf(row, sizeof(row), "%s %s:~3%#5.1f~2/%-9.9s~3%s" , scT(label), N_txt(WORD_abv_swp_txt), rx->pcnt_two, bfT(1), rx->graph); +#else + if (Curwin->rc.double_up > 1) + snprintf(row, sizeof(row), "%s %s~3%3.0f%s" + , scT(label), N_txt(WORD_abv_swp_txt), rx->pcnt_tot, rx->graph); + else { + prT(bfT(1), mkM(MEM_VAL(swp_TOT))); + snprintf(row, sizeof(row), "%s %s:~3%#5.1f~2/%-9.9s~3%s" + , scT(label), N_txt(WORD_abv_swp_txt), rx->pcnt_two, bfT(1), rx->graph); + } +#endif Msg_row += sum_see(row, 1); } else { diff --git a/src/top/top.h b/src/top/top.h index 7408675e..74532f2c 100644 --- a/src/top/top.h +++ b/src/top/top.h @@ -61,6 +61,7 @@ //#define THREADED_MEM /* separate background thread for mem updt */ //#define THREADED_TSK /* separate background thread for tsk updt */ //#define TOG4_MEM_1UP /* don't show two abreast memory statistic */ +//#define TOG4_MEM_FIX /* no variable mem graphs, thus misaligned */ //#define TOG4_SEP_OFF /* don't show two abreast visual separator */ //#define TOG4_SEP_STD /* normal mem sep if 2 abreast & no graphs */ //#define TREE_NORESET /* sort keys should not force 'V' view off */