aboutsummaryrefslogtreecommitdiff
path: root/telegabber.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegabber.go')
-rw-r--r--telegabber.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/telegabber.go b/telegabber.go
index 2752163..14b3b3d 100644
--- a/telegabber.go
+++ b/telegabber.go
@@ -1,6 +1,10 @@
package main
import (
+ "flag"
+ "fmt"
+ "net/http"
+ _ "net/http/pprof"
"os"
"os/signal"
@@ -25,6 +29,15 @@ var cleanupDone chan struct{}
var sigintChannel chan os.Signal
func main() {
+ var profilingPort = flag.Int("profiling-port", 0, "The port for pprof server")
+ flag.Parse()
+
+ if *profilingPort > 0 {
+ go func() {
+ log.Println(http.ListenAndServe(fmt.Sprintf("localhost:%v", *profilingPort), nil))
+ }()
+ }
+
cleanupDone = make(chan struct{})
sigintChannel = make(chan os.Signal, 1)
signal.Notify(sigintChannel, os.Interrupt)