From 7283c4bc94a98a63bd34501eea659955c84d0c9b Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期三, 18 三月 2020 10:52:48 +0800 Subject: [PATCH] delete debug print --- shmqueue.go | 44 +++++--------------------------------------- 1 files changed, 5 insertions(+), 39 deletions(-) diff --git a/shmqueue.go b/shmqueue.go index f926652..c01257f 100644 --- a/shmqueue.go +++ b/shmqueue.go @@ -72,59 +72,24 @@ shmLen = shmblocks*uint32(unsafe.Sizeof(datainfo)) + uint32(unsafe.Sizeof(shmstruct)) data, shmid := CreateRawShm(ctx, int(shmLen), key) - fmt.Println("shmid:", shmid) - fmt.Printf("data:%p\n", data) q := bytes2shmEsQueue(data) - fmt.Printf("q:%p\n", q) - fmt.Println("esqueue:", q) - fmt.Printf("q.capacity:%p\n", &q.capacity) - fmt.Printf("q.capMod:%p\n", &q.capMod) - fmt.Printf("q.putPos:%p\n", &q.putPos) - fmt.Printf("q.getPos:%p\n", &q.getPos) - fmt.Printf("q.cache:%p\n", &q.cache) //init parameters q.capacity = shmblocks q.capMod = q.capacity - 1 q.putPos = 0 q.getPos = 0 - fmt.Println("int(q.capacity)", int(q.capacity)) eqi.EsCaches = ptr2esCache(unsafe.Pointer(&q.cache), int(q.capacity)) - fmt.Printf("EsCaches:%p\n", &eqi.EsCaches) - fmt.Printf("EsCaches[0]:%p\n", &(eqi.EsCaches[0])) - fmt.Printf("EsCaches[1]:%p\n", &(eqi.EsCaches[1])) - fmt.Println("int(q.capacity)", int(q.capacity)) for i := 0; i < int(q.capacity); i++ { - fmt.Println("i", i) - fmt.Printf("EsCaches[%d]:%p\n", i, &(eqi.EsCaches[i])) - fmt.Printf("EsCaches[%d].getNo:%p\n", i, &(eqi.EsCaches[i].getNo)) - fmt.Printf("EsCaches[%d].putNo:%p\n", i, &(eqi.EsCaches[i].putNo)) - eqi.EsCaches[i].getNo = uint32(i) eqi.EsCaches[i].putNo = uint32(i) - fmt.Printf("cache.putNo:%p\n", &(eqi.EsCaches[i].putNo)) - fmt.Printf("cache.putNo:%p\n", &(eqi.EsCaches[i].putNo)) - fmt.Println("cache:", eqi.EsCaches[i]) } cache := &eqi.EsCaches[0] cache.getNo = q.capacity cache.putNo = q.capacity - fmt.Println("cache:", cache) - cache0 := eqi.EsCaches[0] - fmt.Printf("cache0:%p\n", &(cache0)) - fmt.Printf("cache0.getNo:%p\n", &(cache0.getNo)) - fmt.Printf("cache0.putNo:%p\n", &(cache0.putNo)) - fmt.Println("cache0:", cache0) - - cache1 := eqi.EsCaches[1] - fmt.Printf("cache1:%p\n", &(cache1)) - fmt.Printf("cache1.getNo:%p\n", &(cache1.getNo)) - fmt.Printf("cache1.putNo:%p\n", &(cache1.putNo)) - fmt.Println("cache1:", cache1) - - fmt.Println("EsCaches:", eqi.EsCaches) + fmt.Println("NewQueue EsCaches:", eqi.EsCaches) eqi.ShmData = data eqi.ShmID = shmid @@ -140,11 +105,9 @@ var eqi EsQueueInfo data, shmid := AttachRawShm(ctx, key) - fmt.Println("shmid:", shmid) shmdata := bytes2shmEsQueue(data) - fmt.Println("shmdata:", shmdata) eqi.EsCaches = ptr2esCache(unsafe.Pointer(&shmdata.cache), int(shmdata.capacity)) - fmt.Println("EsCaches:", eqi.EsCaches) + fmt.Println("AttachQueue EsCaches:", eqi.EsCaches) eqi.Queue = shmdata eqi.ShmKey = key @@ -371,6 +334,9 @@ // round 鍒版渶杩戠殑2鐨勫�嶆暟 func minQuantity(v uint32) uint32 { + if v < 2 { + return 2 + } v-- v |= v >> 1 v |= v >> 2 -- Gitblit v1.8.0