summaryrefslogtreecommitdiffstats
path: root/contrib/top/display.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-06-27 18:08:48 +0000
committerjhb <jhb@FreeBSD.org>2012-06-27 18:08:48 +0000
commita461bd15071993dd2121ed8ddfaee9fef880cd56 (patch)
tree35d3ccc9768fc207017486150335cd6c1e66bfc4 /contrib/top/display.c
parent31577c974349e71766902ec165bf02f12c744838 (diff)
downloadFreeBSD-src-a461bd15071993dd2121ed8ddfaee9fef880cd56.zip
FreeBSD-src-a461bd15071993dd2121ed8ddfaee9fef880cd56.tar.gz
Add a new line to top that provides a brief summary of the ZFS ARC memory
usage on hosts using ZFS. The new line displays the total amount of RAM used by the ARC along with the size of MFU, MRU, anonymous (in flight), headers, and other (miscellaneous) sub-categories. The line is not displayed on systems that are not using ZFS. Reviewed by: avg, fs@ MFC after: 3 days
Diffstat (limited to 'contrib/top/display.c')
-rw-r--r--contrib/top/display.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/top/display.c b/contrib/top/display.c
index 89795c0..e65ae24 100644
--- a/contrib/top/display.c
+++ b/contrib/top/display.c
@@ -66,6 +66,7 @@ char *screenbuf = NULL;
static char **procstate_names;
static char **cpustate_names;
static char **memory_names;
+static char **arc_names;
static char **swap_names;
static int num_procstates;
@@ -100,6 +101,8 @@ int x_brkdn = 15;
int y_brkdn = 1;
int x_mem = 5;
int y_mem = 3;
+int x_arc = 5;
+int y_arc = 4;
int x_swap = 6;
int y_swap = 4;
int y_message = 5;
@@ -216,6 +219,8 @@ struct statics *statics;
num_memory = string_count(memory_names);
lmemory = (int *)malloc(num_memory * sizeof(int));
+ arc_names = statics->arc_names;
+
/* calculate starting columns where needed */
cpustate_total_length = 0;
pp = cpustate_names;
@@ -627,6 +632,46 @@ int *stats;
}
/*
+ * *_arc(stats) - print "ARC: " followed by the ARC summary string
+ *
+ * Assumptions: cursor is on "lastline"
+ * for i_arc ONLY: cursor is on the previous line
+ */
+char arc_buffer[MAX_COLS];
+
+i_arc(stats)
+
+int *stats;
+
+{
+ if (arc_names == NULL)
+ return (0);
+
+ fputs("\nARC: ", stdout);
+ lastline++;
+
+ /* format and print the memory summary */
+ summary_format(arc_buffer, stats, arc_names);
+ fputs(arc_buffer, stdout);
+}
+
+u_arc(stats)
+
+int *stats;
+
+{
+ static char new[MAX_COLS];
+
+ if (arc_names == NULL)
+ return (0);
+
+ /* format the new line */
+ summary_format(new, stats, arc_names);
+ line_update(arc_buffer, new, x_arc, y_arc);
+}
+
+
+/*
* *_swap(stats) - print "Swap: " followed by the swap summary string
*
* Assumptions: cursor is on "lastline"
OpenPOWER on IntegriCloud