From 682f6abf22ea7c65ab88c9d8f61784ba3bbc88ef Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun Date: Thu, 16 Dec 2021 18:10:05 +0200 Subject: [PATCH] [scripts] Add `pprof` invocation as web server. --- scripts/benchmark.z-run | 14 +++++++++++++- sources/cmd/server/server.go | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/benchmark.z-run b/scripts/benchmark.z-run index 39851e2..bb460bc 100644 --- a/scripts/benchmark.z-run +++ b/scripts/benchmark.z-run @@ -77,14 +77,26 @@ # !! + << benchmark / server / profile / cpu / analyze export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server exec -- go tool pprof "${@}" -- ./.outputs/server-cpu.txt !! +<< benchmark / server / profile / cpu / analyze / web + export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server + exec -- go tool pprof -http 127.108.221.132:8080 -no_browser -functions "${@}" -- ./.outputs/server-cpu.txt +!! + + << benchmark / server / profile / mem / analyze export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server - exec -- go tool pprof "${@}" ./.outputs/server-mem.txt + exec -- go tool pprof "${@}" -- ./.outputs/server-mem.txt +!! + +<< benchmark / server / profile / mem / analyze / web + export -- PPROF_BINARY_PATH=./.outputs/binaries/release/kawipiko-server + exec -- go tool pprof "${@}" -http 127.108.221.132:8080 -no_browser -functions -- ./.outputs/server-mem.txt !! diff --git a/sources/cmd/server/server.go b/sources/cmd/server/server.go index d0661a8..abf29d4 100644 --- a/sources/cmd/server/server.go +++ b/sources/cmd/server/server.go @@ -297,8 +297,6 @@ func (_server *server) Serve (_context *fasthttp.RequestCtx) () { _responseStatus := http.StatusOK -//! _responseHeaders.AddRawLines (_dataMetaRaw) - _handleHeader := func (_name []byte, _value []byte) { if _name[0] != '!' { _responseHeaders.AddBytesKV (_name, _value)