From 685dc3ec6c176fd10580be4862fcbd423f7baa6d Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 8 Mar 2023 20:12:04 -0500 Subject: [PATCH] Initial commit *2 --- README.md | 9 +++++++++ hook/ezprof.go | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 README.md create mode 100644 hook/ezprof.go diff --git a/README.md b/README.md new file mode 100644 index 0000000..084a7fb --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# ezprof + +Host pprof at localhost:8888 in one line. In any Go file, put: + +```go +import _ "git.tebibyte.media/sashakoshka/ezprof/hook" +``` + +And you will be able to connect to your program with the pprof tool. diff --git a/hook/ezprof.go b/hook/ezprof.go new file mode 100644 index 0000000..401d402 --- /dev/null +++ b/hook/ezprof.go @@ -0,0 +1,10 @@ +package ezprof + +import "net/http" +import _ "net/http/pprof" + +func init () { + go func () { + http.ListenAndServe("localhost:8888", nil) + } () +}