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

@ -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
}

View File

@ -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})
}

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>Reply Cache</span></div>
<div class="grid_item grid_stat"><span>{{.TCache}}</span></div>
<div class="grid_item grid_stat"><span>{{.UCache}}</span></div>
<div class="grid_item grid_stat"><span>{{.RCache}}</span></div>
<div class="grid_item grid_stat"><span>{{.TCache}} / {{.TCap}}</span></div>
<div class="grid_item grid_stat"><span>{{.UCache}} / {{.UCap}}</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>