top: adapt for modification to 'MEMINFO_MEM_USED' item
With the library change calculating 'MEMINFO_MEM_USED' top must be tweaked in order to retain the distinction between non-cached used memory and cached used memory. [ assuming one of the two graphs are being displayed ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
2184e90d2e
commit
047d16ccfd
@ -578,8 +578,8 @@ visual graphs of those representations.
|
|||||||
|
|
||||||
In the case of \*(MP, the percentage represents the \fBtotal\fR minus the estimated
|
In the case of \*(MP, the percentage represents the \fBtotal\fR minus the estimated
|
||||||
\fBavail\fR noted above.
|
\fBavail\fR noted above.
|
||||||
The `Mem' graph itself is divided between \fBused\fR and any remaining memory not
|
The `Mem' graph itself is divided between the non-cached portion of \fBused\fR and
|
||||||
otherwise accounted for by \fBavail\fR.
|
any remaining memory not otherwise accounted for by \fBavail\fR.
|
||||||
\*(XT 4b. SUMMARY AREA Commands and the `m' command for additional information
|
\*(XT 4b. SUMMARY AREA Commands and the `m' command for additional information
|
||||||
on that special 4-way toggle.
|
on that special 4-way toggle.
|
||||||
|
|
||||||
|
13
top/top.c
13
top/top.c
@ -6143,7 +6143,7 @@ static void keys_xtra (int ch) {
|
|||||||
* ( surely, this must make us run much more efficiently. amirite? ) | */
|
* ( surely, this must make us run much more efficiently. amirite? ) | */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cpu *Helper* function to show the percentages for one or two cpus |
|
* A *Helper* function to show summary information for up to 2 lines |
|
||||||
* as a single line. We return the number of lines actually printed. | */
|
* as a single line. We return the number of lines actually printed. | */
|
||||||
static inline int sum_see (const char *str, int nobuf) {
|
static inline int sum_see (const char *str, int nobuf) {
|
||||||
static char row[ROWMINSIZ];
|
static char row[ROWMINSIZ];
|
||||||
@ -6410,7 +6410,7 @@ static void do_memory (void) {
|
|||||||
char used[SMLBUFSIZ], util[SMLBUFSIZ], dual[MEDBUFSIZ], row[ROWMINSIZ];
|
char used[SMLBUFSIZ], util[SMLBUFSIZ], dual[MEDBUFSIZ], row[ROWMINSIZ];
|
||||||
float pct_used, pct_misc, pct_swap;
|
float pct_used, pct_misc, pct_swap;
|
||||||
int ix, num_used, num_misc;
|
int ix, num_used, num_misc;
|
||||||
unsigned long my_misc;
|
unsigned long my_ulong;
|
||||||
|
|
||||||
if (!scaletab[0].label) {
|
if (!scaletab[0].label) {
|
||||||
scaletab[0].label = N_txt(AMT_kilobyte_txt);
|
scaletab[0].label = N_txt(AMT_kilobyte_txt);
|
||||||
@ -6422,11 +6422,12 @@ static void do_memory (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Curwin->rc.graph_mems) {
|
if (Curwin->rc.graph_mems) {
|
||||||
pct_used = (float)MEM_VAL(mem_USE) * (100.0 / (float)MEM_VAL(mem_TOT));
|
my_ulong = MEM_VAL(mem_TOT) - MEM_VAL(mem_BUF) - MEM_VAL(mem_QUE) - MEM_VAL(mem_FRE);
|
||||||
|
pct_used = (float)my_ulong * (100.0 / (float)MEM_VAL(mem_TOT));
|
||||||
#ifdef MEMGRAPH_OLD
|
#ifdef MEMGRAPH_OLD
|
||||||
pct_misc = (float)(MEM_VAL(mem_BUF) + MEM_VAL(mem_QUE)) * (100.0 / (float)MEM_VAL(mem_TOT));
|
pct_misc = (float)(MEM_VAL(mem_BUF) + MEM_VAL(mem_QUE)) * (100.0 / (float)MEM_VAL(mem_TOT));
|
||||||
#else
|
#else
|
||||||
pct_misc = (float)(MEM_VAL(mem_TOT) - MEM_VAL(mem_AVL) - MEM_VAL(mem_USE)) * (100.0 / (float)MEM_VAL(mem_TOT));
|
pct_misc = (float)(MEM_VAL(mem_TOT) - MEM_VAL(mem_AVL) - my_ulong) * (100.0 / (float)MEM_VAL(mem_TOT));
|
||||||
#endif
|
#endif
|
||||||
if (pct_used + pct_misc > 100.0 || pct_misc < 0) pct_misc = 0;
|
if (pct_used + pct_misc > 100.0 || pct_misc < 0) pct_misc = 0;
|
||||||
pct_swap = MEM_VAL(swp_TOT) ? (float)MEM_VAL(swp_USE) * (100.0 / (float)MEM_VAL(swp_TOT)) : 0;
|
pct_swap = MEM_VAL(swp_TOT) ? (float)MEM_VAL(swp_USE) * (100.0 / (float)MEM_VAL(swp_TOT)) : 0;
|
||||||
@ -6454,9 +6455,9 @@ static void do_memory (void) {
|
|||||||
Msg_row += sum_see(row, memPARM);
|
Msg_row += sum_see(row, memPARM);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
my_misc = MEM_VAL(mem_BUF) + MEM_VAL(mem_QUE);
|
my_ulong = MEM_VAL(mem_BUF) + MEM_VAL(mem_QUE);
|
||||||
prT(bfT(0), mkM(MEM_VAL(mem_TOT))); prT(bfT(1), mkM(MEM_VAL(mem_FRE)));
|
prT(bfT(0), mkM(MEM_VAL(mem_TOT))); prT(bfT(1), mkM(MEM_VAL(mem_FRE)));
|
||||||
prT(bfT(2), mkM(MEM_VAL(mem_USE))); prT(bfT(3), mkM(my_misc));
|
prT(bfT(2), mkM(MEM_VAL(mem_USE))); prT(bfT(3), mkM(my_ulong));
|
||||||
prT(bfT(4), mkM(MEM_VAL(swp_TOT))); prT(bfT(5), mkM(MEM_VAL(swp_FRE)));
|
prT(bfT(4), mkM(MEM_VAL(swp_TOT))); prT(bfT(5), mkM(MEM_VAL(swp_FRE)));
|
||||||
prT(bfT(6), mkM(MEM_VAL(swp_USE))); prT(bfT(7), mkM(MEM_VAL(mem_AVL)));
|
prT(bfT(6), mkM(MEM_VAL(swp_USE))); prT(bfT(7), mkM(MEM_VAL(mem_AVL)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user