Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Add pprof support
Browse files Browse the repository at this point in the history
  • Loading branch information
tdemin committed Aug 23, 2020
1 parent e1cbb1c commit 784784e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions debug.go
@@ -0,0 +1,23 @@
// +build debug

package main

import (
"log"
"net/http"
_ "net/http/pprof"
"os"
)

func init() {
listen := os.Getenv("SYGGO_HTTP")
if listen == "" {
listen = "[::]:8082"
}
log.Printf("profiling is enabled, HTTP server is attached to %s\n", listen)
go func() {
if err := http.ListenAndServe(listen, nil); err != nil {
log.Fatalf("http failed: %v\n", err)
}
}()
}

0 comments on commit 784784e

Please sign in to comment.