From 943e5b2b9b1af596131f5e8f623bfc514668cd2d Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期一, 09 九月 2019 14:56:12 +0800 Subject: [PATCH] cpu test --- main.go | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 8969110..3a954f7 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,10 @@ "basic.com/dbapi.git" "basic.com/pubsub/protomsg.git" "basic.com/valib/deliver.git" + "net/http" + _ "net/http/pprof" "ruleprocess/insertdata" "ruleprocess/util" - "runtime" "time" //"bufio" @@ -39,7 +40,7 @@ func main() { flag.Parse() wg := sync.WaitGroup{} - wg.Add(2) + wg.Add(3) dbapi.Init(*dbIp, *dbPort) go cache.Init(initchan, *dbIp, *surveyPort, *pubPort) @@ -47,6 +48,9 @@ //fmt.Println("缂撳瓨鍒濆鍖栧畬鎴�",<- initchan)//dbserver鍒濆鍖栧畬姣� ruleserver.Init() go ruleserver.TimeTicker() + go func() { + http.ListenAndServe("0:0:0:0:8069",nil) + }() go ruleserver.StartServer() nReciever("ipc:///tmp/sdk-2-rules-process.ipc", deliver.PushPull, 1) wg.Wait() @@ -73,9 +77,9 @@ fmt.Println("recv error : ", err) continue } else { - runtime.GOMAXPROCS(runtime.NumCPU()) - logger.Debug("浣跨敤鐨刢pu涓暟锛�",runtime.NumCPU()) - go func(msg []byte) { + //runtime.GOMAXPROCS(runtime.NumCPU()) + //logger.Debug("浣跨敤鐨刢pu涓暟锛�",runtime.NumCPU()) + //go func(msg []byte) { logger.Debug("褰撳墠鏃堕棿鎴筹細", time.Now().Unix()) arg := ruleserver.SdkDatas{} //paramFormat(msg, &arg) @@ -91,7 +95,7 @@ logger.Debug("鎻掑叆瀹孍s鎵�鐢ㄦ椂闂达細", time.Since(start)) //浜嬩欢鎺ㄩ�� //go labelFilter.Judge(resultMsg) - }(msg) + //}(msg) } } } @@ -125,7 +129,7 @@ } // 鍏堣繘琛屼竴涓嬭拷韪� - //ruleserver.FaceIsSame(&m) + ruleserver.FaceIsSame(&m) args.CameraId = m.Cid args.TaskId = m.Tasklab.Taskid // 鎶婂浘鐗囩殑浜岃繘鍒惰В鍘嬬缉杩涜鐢绘鍦ㄥ帇缂╁洖鍘� -- Gitblit v1.8.0