add
This commit is contained in:
parent
599fb597e8
commit
8fb7712b54
11
main.go
11
main.go
@ -5,6 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/esrrhs/go-engine/src/loggo"
|
"github.com/esrrhs/go-engine/src/loggo"
|
||||||
"github.com/esrrhs/go-engine/src/pingtunnel"
|
"github.com/esrrhs/go-engine/src/pingtunnel"
|
||||||
|
"net/http"
|
||||||
|
_ "net/http/pprof"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -80,6 +82,9 @@ Usage:
|
|||||||
|
|
||||||
-maxprb server最大处理线程buffer数,默认1000
|
-maxprb server最大处理线程buffer数,默认1000
|
||||||
max process thread's buffer in server, default 1000
|
max process thread's buffer in server, default 1000
|
||||||
|
|
||||||
|
-profile 在端口开启性能检测,默认0不开启
|
||||||
|
open profile on the port, default 0 is off
|
||||||
`
|
`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -102,6 +107,7 @@ func main() {
|
|||||||
maxconn := flag.Int("maxconn", 0, "max num of connections")
|
maxconn := flag.Int("maxconn", 0, "max num of connections")
|
||||||
max_process_thread := flag.Int("maxprt", 100, "max process thread in server")
|
max_process_thread := flag.Int("maxprt", 100, "max process thread in server")
|
||||||
max_process_buffer := flag.Int("maxprb", 1000, "max process thread's buffer in server")
|
max_process_buffer := flag.Int("maxprb", 1000, "max process thread's buffer in server")
|
||||||
|
profile := flag.Int("profile", 0, "open profile")
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
fmt.Printf(usage)
|
fmt.Printf(usage)
|
||||||
}
|
}
|
||||||
@ -187,6 +193,11 @@ func main() {
|
|||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *profile > 0 {
|
||||||
|
go http.ListenAndServe("0.0.0.0:"+strconv.Itoa(8080), nil)
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Hour)
|
time.Sleep(time.Hour)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user