Skip to content

Commit 47c533c

Browse files
author
daniel840829
committed
s
1 parent 37a4cb1 commit 47c533c

7 files changed

+13
-1
lines changed
0 Bytes
Binary file not shown.
47.7 KB
Binary file not shown.

Session.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
88
let s:wipebuf = bufnr('%')
99
endif
1010
set shortmess=aoO
11-
badd +1 Dockerfile
1211
badd +1 main.go
12+
badd +1 Dockerfile
1313
badd +159 game/session/room.go
1414
badd +1 game.log
1515
badd +1 entity/entity.go

cpu.prof

Whitespace-only changes.

main

13.9 MB
Binary file not shown.

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/daniel840829/gameServer/game"
99
"github.com/daniel840829/gameServer/msg"
1010
"google.golang.org/grpc"
11+
"runtime/pprof"
1112
//"google.golang.org/grpc/grpclog"
1213
"flag"
1314
"fmt"
@@ -28,6 +29,7 @@ var (
2829
AgentPort *string
2930
AgentToGamePort *string
3031
ClientToGamePort *string
32+
cpuprofile *string
3133
)
3234

3335
func main() {
@@ -37,8 +39,18 @@ func main() {
3739
AgentPort = flag.String("agentPort", "50051", "ClientToAgent Port")
3840
AgentToGamePort = flag.String("agentToGamePort", "3000", "AgentToGame Port")
3941
ClientToGamePort = flag.String("clientToGamePort", "8080", "ClientToGame Port")
42+
cpuprofile = flag.String("cpuprofile", "./cpu.prof", "write cpu profile to file,set blank to close profile function")
4043
log.Debug("config :", "type :", serverType)
4144
flag.Parse()
45+
46+
if *cpuprofile != "" {
47+
f, err := os.Create(*cpuprofile)
48+
if err != nil {
49+
log.Fatal(err)
50+
}
51+
pprof.StartCPUProfile(f)
52+
defer pprof.StopCPUProfile()
53+
}
4254
if *serverType == "agent" {
4355
RunAgent()
4456
} else if *serverType == "game" {

new.prof

Whitespace-only changes.

0 commit comments

Comments
 (0)