.TP
\fBcached\fR
Memory used by the page cache (Cached in /proc/meminfo)
+.TP
+\fBavailable\fR
+Estimation of how much memory is available for starting
+new applications, without swapping. Unlike the data
+provided by the \fBcached\fR or \fBfree\fR 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 (MemAvailable in /proc/meminfo)
.SH OPTIONS
.TP
\fB\-b\fR, \fB\-\-bytes\fR
If unit is missing, and you have petabyte of RAM or swap, the number is in
terabytes and columns might not be aligned with header.
.TP
+\fB\-a\fR, \fB\-\-available\fR
+Display the estimation of memory available for starting new applications,
+without swapping. This switch makes the output wider than 80 characters.
+.TP
\fB\-c\fR, \fB\-\-count\fR \fIcount\fR
Display the result
.I count
#define FREE_SI (1 << 5)
#define FREE_REPEAT (1 << 6)
#define FREE_REPEATCOUNT (1 << 7)
+#define FREE_AVAILABLE (1 << 8)
struct commandline_arguments {
int exponent; /* demanded in kilos, magas... */
fputs(_(" -t, --total show total for RAM + swap\n"), out);
fputs(_(" -s N, --seconds N repeat printing every N seconds\n"), out);
fputs(_(" -c N, --count N repeat printing N times, then exit\n"), out);
+ fputs(_(" -a, --available show available memory\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_(" --help display this help and exit\n"), out);
fputs(USAGE_VERSION, out);
{ "total", no_argument, NULL, 't' },
{ "seconds", required_argument, NULL, 's' },
{ "count", required_argument, NULL, 'c' },
+ { "available", no_argument, NULL, 'a' },
{ "help", no_argument, NULL, HELP_OPTION },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
textdomain(PACKAGE);
atexit(close_stdout);
- while ((c = getopt_long(argc, argv, "bkmghlotc:s:V", longopts, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "bkmghlotc:as:V", longopts, NULL)) != -1)
switch (c) {
case 'b':
args.exponent = 1;
error(EXIT_FAILURE, ERANGE,
_("failed to parse count argument: '%s'"), optarg);
break;
+ case 'a':
+ flags |= FREE_AVAILABLE;
+ break;
case HELP_OPTION:
usage(stdout);
case 'V':
/* Translation Hint: You can use 9 character words in
* the header, and the words need to be right align to
* beginning of a number. */
- printf("%s\n", _(" total used free shared buffers cached"));
+ printf(_(" total used free shared buffers cached"));
+ if (flags & FREE_AVAILABLE) printf(_(" available"));
+ printf("\n");
printf("%-7s", _("Mem:"));
printf(" %10s", scale_size(kb_main_total, flags, args));
printf(" %10s", scale_size(kb_main_used, flags, args));
printf(" %10s", scale_size(kb_main_shared, flags, args));
printf(" %10s", scale_size(kb_main_buffers, flags, args));
printf(" %10s", scale_size(kb_main_cached, flags, args));
+ if (flags & FREE_AVAILABLE) printf(" %10s", scale_size(kb_main_available, flags, args));
printf("\n");
/*
* Print low vs. high information, if the user requested it.
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;
{"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},