mirror of https://github.com/cbeuw/Cloak
pprof now will not require debug build flag
This commit is contained in:
parent
f9c5ce8560
commit
0695f9df13
5
Makefile
5
Makefile
|
|
@ -16,11 +16,6 @@ server:
|
||||||
go build -ldflags "-X main.version=${version}" ./cmd/ck-server
|
go build -ldflags "-X main.version=${version}" ./cmd/ck-server
|
||||||
mv ck-server* ./build
|
mv ck-server* ./build
|
||||||
|
|
||||||
server_pprof:
|
|
||||||
mkdir -p build
|
|
||||||
go build -ldflags "-X main.version=${version}" -tags pprof ./cmd/ck-server
|
|
||||||
mv ck-server* ./build
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mv build/ck-* /usr/local/bin
|
mv build/ck-* /usr/local/bin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -244,7 +245,12 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *pprofAddr != "" {
|
if *pprofAddr != "" {
|
||||||
startPprof(*pprofAddr)
|
runtime.SetBlockProfileRate(5)
|
||||||
|
go func() {
|
||||||
|
log.Println(http.ListenAndServe(*pprofAddr, nil))
|
||||||
|
}()
|
||||||
|
log.Println("pprof listening on " + *pprofAddr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Starting standalone mode, listening on %v:%v", bindHost, bindPort)
|
log.Printf("Starting standalone mode, listening on %v:%v", bindHost, bindPort)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
// +build !pprof
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "log"
|
|
||||||
|
|
||||||
func startPprof(x string) {
|
|
||||||
log.Println("pprof not available in release builds to reduce binary size")
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
// +build pprof
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
_ "net/http/pprof"
|
|
||||||
"runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
func startPprof(pprofAddr string) {
|
|
||||||
runtime.SetBlockProfileRate(5)
|
|
||||||
go func() {
|
|
||||||
log.Println(http.ListenAndServe(pprofAddr, nil))
|
|
||||||
}()
|
|
||||||
log.Println("pprof listening on " + pprofAddr)
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue