Skip to content

Commit

Permalink
update: 隐藏CPU性能跟踪参数
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchuanchuan committed Mar 1, 2020
1 parent f74f7ad commit 5768c81
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmd/bingo2sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ var (
showAllTime = flagBoolean("show-all-time", "", false, "显示每条SQL的执行时间")
showThread = flagBoolean("show-thread", "", false, "显示线程号,便于区别同一进程操作")

debug = flagBoolean("debug", "", false, "调试模式,输出详细日志")
debugProfile = flagBoolean("debug-profile", "", false, "profile调试")
debug = flagBoolean("debug", "", false, "调试模式,输出详细日志")
cpuProfile = flagBoolean("cpu-profile", "", false, "调试模式,开启CPU性能跟踪")
)

func main() {

flag.SortFlags = false
// 隐藏CPU性能跟踪调试参数
flag.MarkHidden("cpu-profile")

if err := flag.Parse(os.Args[1:]); err != nil {
log.Error(err)
Expand All @@ -101,19 +103,19 @@ func main() {
}

// defer profile.Start(profile.MemProfile).Stop()
if *debugProfile {
defer profile.Start(profile.ProfilePath("/tmp")).Stop()
if *cpuProfile {
defer profile.Start(profile.ProfilePath(".")).Stop()
}

// parserProcess = make(map[string]*parser.MyBinlogParser)

if *configFile == "" {
flag.Usage()
return
}

// 以服务方式运行
if *runServer {
if *configFile == "" {
flag.Usage()
return
}

startServer()
} else {
if *debug {
Expand Down

0 comments on commit 5768c81

Please sign in to comment.