aboutsummaryrefslogtreecommitdiff
path: root/http_handle_index.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-09 20:28:08 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-09 20:28:08 +0800
commit8af94f323d86c3cae992dc5ff4896bae52f208e8 (patch)
tree38bec3c6ea0950458d2840398ce285068bf99995 /http_handle_index.go
parentindex: Remove unnecessary newlines in td (diff)
downloadforge-8af94f323d86c3cae992dc5ff4896bae52f208e8.tar.gz
forge-8af94f323d86c3cae992dc5ff4896bae52f208e8.tar.zst
forge-8af94f323d86c3cae992dc5ff4896bae52f208e8.zip
index: Humanize allocated size
Diffstat (limited to '')
-rw-r--r--http_handle_index.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/http_handle_index.go b/http_handle_index.go
index 623c619..144e9ab 100644
--- a/http_handle_index.go
+++ b/http_handle_index.go
@@ -6,6 +6,8 @@ package main
import (
"net/http"
"runtime"
+
+ "github.com/dustin/go-humanize"
)
func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any) {
@@ -22,6 +24,6 @@ func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any)
// Memory currently allocated
memstats := runtime.MemStats{}
runtime.ReadMemStats(&memstats)
- params["mem"] = memstats.Alloc
+ params["mem"] = humanize.IBytes(memstats.Alloc)
render_template(w, "index", params)
}