Show memory usage on the version page
This commit is contained in:
parent
da970239a5
commit
5be599589a
14
meta/meta.go
Normal file
14
meta/meta.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package meta
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MemInfo() string {
|
||||||
|
stats := runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(&stats)
|
||||||
|
|
||||||
|
return fmt.Sprintf("%.3fMb", float64(stats.Alloc)/1024.0/1024.0)
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,9 @@
|
|||||||
<div class="grid-x grid-padding-x">
|
<div class="grid-x grid-padding-x">
|
||||||
<div class="large-12 cell">
|
<div class="large-12 cell">
|
||||||
|
|
||||||
|
<h5>Memory Usage</h5>
|
||||||
|
<p>{{ meminfo }}</p>
|
||||||
|
|
||||||
<h5>Release info</h5>
|
<h5>Release info</h5>
|
||||||
{{ if not version.Remote.Valid }}
|
{{ if not version.Remote.Valid }}
|
||||||
<p>GitHub version information not yet fetched.</p>
|
<p>GitHub version information not yet fetched.</p>
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/tardisx/linkwallet/db"
|
"github.com/tardisx/linkwallet/db"
|
||||||
"github.com/tardisx/linkwallet/entity"
|
"github.com/tardisx/linkwallet/entity"
|
||||||
|
"github.com/tardisx/linkwallet/meta"
|
||||||
"github.com/tardisx/linkwallet/version"
|
"github.com/tardisx/linkwallet/version"
|
||||||
|
|
||||||
"github.com/gomarkdown/markdown"
|
"github.com/gomarkdown/markdown"
|
||||||
@ -82,6 +83,7 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
|||||||
"niceURL": niceURL,
|
"niceURL": niceURL,
|
||||||
"join": strings.Join,
|
"join": strings.Join,
|
||||||
"version": func() *version.Info { return &version.VersionInfo },
|
"version": func() *version.Info { return &version.VersionInfo },
|
||||||
|
"meminfo": meta.MemInfo,
|
||||||
"markdown": func(s string) template.HTML { return template.HTML(string(markdown.ToHTML([]byte(s), nil, nil))) },
|
"markdown": func(s string) template.HTML { return template.HTML(string(markdown.ToHTML([]byte(s), nil, nil))) },
|
||||||
}).ParseFS(templateFiles, "templates/*.html"))
|
}).ParseFS(templateFiles, "templates/*.html"))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user