Add the cache capacities to the debug page.

This commit is contained in:
Azareal 2019-05-17 20:38:46 +10:00
parent b9973719a5
commit 182a5640eb
3 changed files with 16 additions and 7 deletions

View File

@ -595,6 +595,11 @@ type PanelDebugPage struct {
TCache int TCache int
UCache int UCache int
RCache int RCache int
TCap int
UCap int
RCap int
TopicListThaw bool TopicListThaw bool
} }

View File

@ -42,20 +42,24 @@ func Debug(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
runtime.ReadMemStats(&memStats) runtime.ReadMemStats(&memStats)
var tlen, ulen, rlen int var tlen, ulen, rlen int
var tcap, ucap, rcap int
tcache := c.Topics.GetCache() tcache := c.Topics.GetCache()
if tcache != nil { if tcache != nil {
tlen = tcache.Length() tlen = tcache.Length()
tcap = tcache.GetCapacity()
} }
ucache := c.Users.GetCache() ucache := c.Users.GetCache()
if ucache != nil { if ucache != nil {
ulen = ucache.Length() ulen = ucache.Length()
ucap = ucache.GetCapacity()
} }
rcache := c.Rstore.GetCache() rcache := c.Rstore.GetCache()
if rcache != nil { if rcache != nil {
rlen = rcache.Length() rlen = rcache.Length()
rcap = rcache.GetCapacity()
} }
topicListThawed := c.TopicListThaw.Thawed() 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}) return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "panel_dashboard_right", "debug_page", "panel_debug", pi})
} }

View File

@ -77,9 +77,9 @@
<div class="grid_item grid_stat grid_stat_head"><span>User Cache</span></div> <div class="grid_item grid_stat grid_stat_head"><span>User Cache</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Reply Cache</span></div> <div class="grid_item grid_stat grid_stat_head"><span>Reply Cache</span></div>
<div class="grid_item grid_stat"><span>{{.TCache}}</span></div> <div class="grid_item grid_stat"><span>{{.TCache}} / {{.TCap}}</span></div>
<div class="grid_item grid_stat"><span>{{.UCache}}</span></div> <div class="grid_item grid_stat"><span>{{.UCache}} / {{.UCap}}</span></div>
<div class="grid_item grid_stat"><span>{{.RCache}}</span></div> <div class="grid_item grid_stat"><span>{{.RCache}} / {{.RCap}}</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Topic List</span></div> <div class="grid_item grid_stat grid_stat_head"><span>Topic List</span></div>