From 9dc6cc88402c4945196494f851fad42956aa12c8 Mon Sep 17 00:00:00 2001 From: Remco Date: Thu, 19 May 2016 21:38:50 +0200 Subject: [PATCH] added profiling --- .gitignore | 5 +++++ transfersh-server/main.go | 29 ++--------------------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index f8201fb..ca60910 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ node_modules/ transfersh-server/run.sh .elasticbeanstalk/ + +# Elastic Beanstalk Files +.elasticbeanstalk/* +!.elasticbeanstalk/*.cfg.yml +!.elasticbeanstalk/*.global.yml diff --git a/transfersh-server/main.go b/transfersh-server/main.go index dd3aa82..2ef722a 100644 --- a/transfersh-server/main.go +++ b/transfersh-server/main.go @@ -43,8 +43,6 @@ import ( "github.com/PuerkitoBio/ghost/handlers" "github.com/gorilla/mux" - "github.com/pkg/profile" - _ "net/http/pprof" ) @@ -85,27 +83,8 @@ func main() { runtime.GOMAXPROCS(nCPU) fmt.Println("Number of CPUs: ", nCPU) - var profiler interface { - Stop() - } = nil - - profiler = profile.Start(profile.CPUProfile, profile.ProfilePath("."), profile.NoShutdownHook) - /* - if c.GlobalBool("cpu-profile") { - log.Info("CPU profiler started.") - profiler = profile.Start(profile.CPUProfile, profile.ProfilePath("."), profile.NoShutdownHook) - } else if c.GlobalBool("mem-profile") { - log.Info("Memory profiler started.") - profiler = profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook) - } - - if c.GlobalBool("profiler") { - log.Info("Profiler listening.") - - } - */ - go func() { + fmt.Println("Profiled listening at: :6060") http.ListenAndServe(":6060", nil) }() @@ -209,7 +188,7 @@ func main() { } go func() { - log.Panic(s.ListenAndServe()) + s.ListenAndServe() }() term := make(chan os.Signal, 1) @@ -218,9 +197,5 @@ func main() { <-term - if profiler != nil { - profiler.Stop() - } - log.Printf("Server stopped.") }