god dam it
This commit is contained in:
parent
4cd4374e38
commit
f7ee80c8f9
10
README.md
10
README.md
|
@ -1,9 +1,15 @@
|
||||||
# ezprof
|
# 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
|
```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.
|
And you will be able to connect to your program with the pprof tool.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package hook
|
||||||
import "net/http"
|
import "net/http"
|
||||||
import _ "net/http/pprof"
|
import _ "net/http/pprof"
|
||||||
|
|
||||||
func init () {
|
func Prof () {
|
||||||
go func () {
|
go func () {
|
||||||
err := http.ListenAndServe("localhost:9090", nil)
|
err := http.ListenAndServe("localhost:9090", nil)
|
||||||
if err != nil { panic(err.Error()) }
|
if err != nil { panic(err.Error()) }
|
Loading…
Reference in New Issue