free: support for MemAvailable
This commit adds a new switch -a/--available that appends a new column called 'available' to the output. The column displays an estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the 'cached' or 'free' fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use.
This commit is contained in:
@ -26,6 +26,7 @@ global:
|
||||
kb_inactive;
|
||||
kb_low_free;
|
||||
kb_low_total;
|
||||
kb_main_available;
|
||||
kb_main_buffers;
|
||||
kb_main_cached;
|
||||
kb_main_free;
|
||||
|
@ -573,6 +573,7 @@ unsigned long kb_high_free;
|
||||
unsigned long kb_high_total;
|
||||
unsigned long kb_low_free;
|
||||
unsigned long kb_low_total;
|
||||
unsigned long kb_main_available;
|
||||
/* 2.4.xx era */
|
||||
unsigned long kb_active;
|
||||
unsigned long kb_inact_laundry;
|
||||
@ -629,6 +630,7 @@ void meminfo(void){
|
||||
{"LowFree", &kb_low_free},
|
||||
{"LowTotal", &kb_low_total},
|
||||
{"Mapped", &kb_mapped}, // kB version of vmstat nr_mapped
|
||||
{"MemAvailable", &kb_main_available}, // important
|
||||
{"MemFree", &kb_main_free}, // important
|
||||
{"MemTotal", &kb_main_total}, // important
|
||||
{"NFS_Unstable", &kb_nfs_unstable},
|
||||
|
@ -34,6 +34,7 @@ extern unsigned long kb_high_free;
|
||||
extern unsigned long kb_high_total;
|
||||
extern unsigned long kb_low_free;
|
||||
extern unsigned long kb_low_total;
|
||||
extern unsigned long kb_main_available;
|
||||
/* 2.4.xx era */
|
||||
extern unsigned long kb_active;
|
||||
extern unsigned long kb_inact_laundry; // grrr...
|
||||
|
Reference in New Issue
Block a user