diff options
Diffstat (limited to 'usr.bin/top')
-rw-r--r-- | usr.bin/top/machine.c | 40 | ||||
-rw-r--r-- | usr.bin/top/top.local.1 | 21 |
2 files changed, 51 insertions, 10 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 492a62a..e5f5e06 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -188,6 +188,12 @@ char *arcnames[] = { NULL }; +int carc_stats[5]; +char *carcnames[] = { + "K Compressed, ", "K Uncompressed, ", ":1 Ratio, ", "K Overhead", + NULL +}; + int swap_stats[7]; char *swapnames[] = { "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out", @@ -223,6 +229,7 @@ static long total_majflt; /* these are for getting the memory statistics */ static int arc_enabled; +static int carc_enabled; static int pageshift; /* log base 2 of the pagesize */ /* define pagetok in terms of pageshift */ @@ -283,16 +290,18 @@ update_layout(void) y_mem = 3; y_arc = 4; - y_swap = 4 + arc_enabled; - y_idlecursor = 5 + arc_enabled; - y_message = 5 + arc_enabled; - y_header = 6 + arc_enabled; - y_procs = 7 + arc_enabled; - Header_lines = 7 + arc_enabled; + y_carc = 5; + y_swap = 4 + arc_enabled + carc_enabled; + y_idlecursor = 5 + arc_enabled + carc_enabled; + y_message = 5 + arc_enabled + carc_enabled; + y_header = 6 + arc_enabled + carc_enabled; + y_procs = 7 + arc_enabled + carc_enabled; + Header_lines = 7 + arc_enabled + carc_enabled; if (pcpu_stats) { y_mem += ncpus - 1; y_arc += ncpus - 1; + y_carc += ncpus - 1; y_swap += ncpus - 1; y_idlecursor += ncpus - 1; y_message += ncpus - 1; @@ -307,6 +316,7 @@ machine_init(struct statics *statics, char do_unames) { int i, j, empty, pagesize; uint64_t arc_size; + boolean_t carc_en; size_t size; struct passwd *pw; @@ -318,6 +328,10 @@ machine_init(struct statics *statics, char do_unames) size != sizeof(smpmode)) smpmode = 0; + size = sizeof(carc_en); + if (sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size, + NULL, 0) == 0 && carc_en == 1) + carc_enabled = 1; size = sizeof(arc_size); if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size, NULL, 0) == 0 && arc_size != 0) @@ -368,6 +382,10 @@ machine_init(struct statics *statics, char do_unames) statics->arc_names = arcnames; else statics->arc_names = NULL; + if (carc_enabled) + statics->carc_names = carcnames; + else + statics->carc_names = NULL; statics->swap_names = swapnames; #ifdef ORDER statics->order_names = ordernames; @@ -559,6 +577,16 @@ get_system_info(struct system_info *si) arc_stats[5] = arc_stat >> 10; si->arc = arc_stats; } + if (carc_enabled) { + GETSYSCTL("kstat.zfs.misc.arcstats.compressed_size", arc_stat); + carc_stats[0] = arc_stat >> 10; + GETSYSCTL("kstat.zfs.misc.arcstats.uncompressed_size", arc_stat); + carc_stats[1] = arc_stat >> 10; + carc_stats[2] = arc_stats[0]; /* ARC Total */ + GETSYSCTL("kstat.zfs.misc.arcstats.overhead_size", arc_stat); + carc_stats[3] = arc_stat >> 10; + si->carc = carc_stats; + } /* set arrays and strings */ if (pcpu_stats) { diff --git a/usr.bin/top/top.local.1 b/usr.bin/top/top.local.1 index 864ab8d..416d80a 100644 --- a/usr.bin/top/top.local.1 +++ b/usr.bin/top/top.local.1 @@ -2,9 +2,10 @@ .SH "FreeBSD NOTES" .SH DESCRIPTION OF MEMORY -Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free -ARC: 2048K Total, 342K MRU, 760K MFU, 272K Anon, 232K Header, 442K Other -Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out +Mem: 61M Active, 86M Inact, 22G Wired, 1M Cache, 2M Buf, 102G Free +ARC: 15G Total, 9303M MFU, 6155M MRU, 1464K Anon, 98M Header, 35M Other + 15G Compressed, 27G Uncompressed, 1.75:1 Ratio, 174M Overhead +Swap: 4096M Total, 532M Free, 13% Inuse, 80K In, 104K Out .TP .B K: Kilobyte @@ -55,8 +56,20 @@ number of ARC bytes holding in flight data .B Header: number of ARC bytes holding headers .TP -.B Other +.B Other: miscellaneous ARC bytes +.TP +.B Compressed: +bytes of memory used by ARC caches +.TP +.B Uncompressed: +bytes of data stored in ARC caches before compression +.TP +.B Ratio: +ratio of uncompressed data to total ARC size +.TP +.B Overhead: +amount of overhead from ARC compression .SS Swap Stats .TP .B Total: |