diff --git a/README.md b/README.md index 084a7fb..214a84d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ # ezprof -Host pprof at localhost:8888 in one line. In any Go file, put: +Host pprof at localhost:8888. In any Go file, put: ```go -import _ "git.tebibyte.media/sashakoshka/ezprof/hook" +import "git.tebibyte.media/sashakoshka/ezprof/ez" + +func main () { + ... + ez.Prof() + ... +} ``` And you will be able to connect to your program with the pprof tool. diff --git a/hook/hook.go b/ez/hook.go similarity index 91% rename from hook/hook.go rename to ez/hook.go index 373bb7c..9d0c022 100644 --- a/hook/hook.go +++ b/ez/hook.go @@ -3,7 +3,7 @@ package hook import "net/http" import _ "net/http/pprof" -func init () { +func Prof () { go func () { err := http.ListenAndServe("localhost:9090", nil) if err != nil { panic(err.Error()) }