From 182a5640eb9f96f3010f4d2625d5415ed3ec4c6b Mon Sep 17 00:00:00 2001 From: Azareal Date: Fri, 17 May 2019 20:38:46 +1000 Subject: [PATCH] Add the cache capacities to the debug page. --- common/pages.go | 11 ++++++++--- routes/panel/debug.go | 6 +++++- templates/panel_debug.html | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/common/pages.go b/common/pages.go index 5cc91882..c27a5da7 100644 --- a/common/pages.go +++ b/common/pages.go @@ -592,9 +592,14 @@ type PanelDebugPage struct { CPUs int MemStats runtime.MemStats - TCache int - UCache int - RCache int + TCache int + UCache int + RCache int + + TCap int + UCap int + RCap int + TopicListThaw bool } diff --git a/routes/panel/debug.go b/routes/panel/debug.go index 637415a6..8b6ab7fb 100644 --- a/routes/panel/debug.go +++ b/routes/panel/debug.go @@ -42,20 +42,24 @@ func Debug(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError { runtime.ReadMemStats(&memStats) var tlen, ulen, rlen int + var tcap, ucap, rcap int tcache := c.Topics.GetCache() if tcache != nil { tlen = tcache.Length() + tcap = tcache.GetCapacity() } ucache := c.Users.GetCache() if ucache != nil { ulen = ucache.Length() + ucap = ucache.GetCapacity() } rcache := c.Rstore.GetCache() if rcache != nil { rlen = rcache.Length() + rcap = rcache.GetCapacity() } topicListThawed := c.TopicListThaw.Thawed() - pi := c.PanelDebugPage{basePage, goVersion, dbVersion, uptime, openConnCount, qgen.Builder.GetAdapter().GetName(), goroutines, cpus, memStats, tlen, ulen, rlen, topicListThawed} + pi := c.PanelDebugPage{basePage, goVersion, dbVersion, uptime, openConnCount, qgen.Builder.GetAdapter().GetName(), goroutines, cpus, memStats, tlen, ulen, rlen, tcap, ucap, rcap, topicListThawed} return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "panel_dashboard_right", "debug_page", "panel_debug", pi}) } diff --git a/templates/panel_debug.html b/templates/panel_debug.html index 75ceb230..f8918f98 100644 --- a/templates/panel_debug.html +++ b/templates/panel_debug.html @@ -77,9 +77,9 @@
User Cache
Reply Cache
-
{{.TCache}}
-
{{.UCache}}
-
{{.RCache}}
+
{{.TCache}} / {{.TCap}}
+
{{.UCache}} / {{.UCap}}
+
{{.RCache}} / {{.RCap}}
Topic List