| 12345678910111213141516171819202122232425262728293031 |
- package main
- import (
- "log"
- "net/http"
- _ "net/http/pprof"
- "os"
- "runtime/pprof"
- "time"
- )
- type pprofDemo struct {
- }
- func (demo *pprofDemo) start() {
- // Http pprof
- // http://127.0.0.1:8000/debug/pprof
- //hello := func(w http.ResponseWriter, req *http.Request) {
- // _, _ = w.Write([]byte("Hello, world!"))
- //}
- //http.HandleFunc("/", hello)
- if err := http.ListenAndServe(":8000", nil); err != nil {
- log.Fatal(err)
- }
- }
- func main() {
- demo := new(pprofDemo)
- demo.start()
- }
|