mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-26 22:20:18 +01:00
added profiling
This commit is contained in:
parent
5061fb96f5
commit
9dc6cc8840
2 changed files with 7 additions and 27 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -14,3 +14,8 @@ node_modules/
|
||||||
|
|
||||||
transfersh-server/run.sh
|
transfersh-server/run.sh
|
||||||
.elasticbeanstalk/
|
.elasticbeanstalk/
|
||||||
|
|
||||||
|
# Elastic Beanstalk Files
|
||||||
|
.elasticbeanstalk/*
|
||||||
|
!.elasticbeanstalk/*.cfg.yml
|
||||||
|
!.elasticbeanstalk/*.global.yml
|
||||||
|
|
|
@ -43,8 +43,6 @@ import (
|
||||||
"github.com/PuerkitoBio/ghost/handlers"
|
"github.com/PuerkitoBio/ghost/handlers"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
|
||||||
"github.com/pkg/profile"
|
|
||||||
|
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -85,27 +83,8 @@ func main() {
|
||||||
runtime.GOMAXPROCS(nCPU)
|
runtime.GOMAXPROCS(nCPU)
|
||||||
fmt.Println("Number of CPUs: ", 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() {
|
go func() {
|
||||||
|
fmt.Println("Profiled listening at: :6060")
|
||||||
http.ListenAndServe(":6060", nil)
|
http.ListenAndServe(":6060", nil)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -209,7 +188,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Panic(s.ListenAndServe())
|
s.ListenAndServe()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
term := make(chan os.Signal, 1)
|
term := make(chan os.Signal, 1)
|
||||||
|
@ -218,9 +197,5 @@ func main() {
|
||||||
|
|
||||||
<-term
|
<-term
|
||||||
|
|
||||||
if profiler != nil {
|
|
||||||
profiler.Stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("Server stopped.")
|
log.Printf("Server stopped.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue