Commit Diff


commit - befa807e5bfef47c79310f7ab3b7038042a49ee8
commit + eeebca225c95bf47ffc0c201333434720529d567
blob - 40def3c21d3ee0972bbda48f6fd9e3ed475b5ce9
blob + d391719551d20d5835ac79f7252652416f9d9aef
--- cmd.c
+++ cmd.c
@@ -22,6 +22,7 @@
 
 #include "compl.h"
 #include "defaults.h"
+#include "mcache.h"
 #include "minibuffer.h"
 #include "session.h"
 #include "telescope.h"
@@ -972,3 +973,17 @@ cmd_toggle_downloads(struct buffer *buffer)
 {
 	ui_toggle_side_window(SIDE_WINDOW_BOTTOM);
 }
+
+void
+cmd_cache_info(struct buffer *buffer)
+{
+	size_t	npages, tot;
+	char	fmt[FMT_SCALED_STRSIZE];
+
+	mcache_info(&npages, &tot);
+
+	if (fmt_scaled(tot, fmt) == 0)
+		message("Cache: pages: %zu, total: %s", npages, fmt);
+	else
+		message("Cache: pages: %zu, total: %zu", npages, tot);
+}
blob - 3a94d6f4dfe7251a846e41b3996fbfdfa3da85bf
blob + 272e2191c1ae4e6924992ef1e882b9d670c56b35
--- cmd.h
+++ cmd.h
@@ -7,6 +7,7 @@ CMD(cmd_backward_char,		"Move point one character back
 CMD(cmd_backward_paragraph,	"Move point on paragraph backward.");
 CMD(cmd_beginning_of_buffer,	"Move point to the beginning of the buffer.");
 CMD(cmd_bookmark_page,		"Save a page in the bookmark file.");
+CMD(cmd_cache_info,		"Show cache stats.");
 CMD(cmd_clear_minibuf,		"Clear the echo area.");
 CMD(cmd_dec_fill_column,	"Decrement fill-column by two.");
 CMD(cmd_end_of_buffer,		"Move the point to the end of the buffer.");