]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-stat/main.go
Intermediate .nock packets step
[nncp.git] / src / cmd / nncp-stat / main.go
index 994f83db6a8a1fdb66373f61e7d5fc9a20e90d2b..bd350c71def19ca60f7feb35ee64178ab4f04144 100644 (file)
@@ -98,6 +98,8 @@ func main() {
                fmt.Println(node.Name)
                rxNums := make(map[uint8]int)
                rxBytes := make(map[uint8]int64)
+               noCKNums := make(map[uint8]int)
+               noCKBytes := make(map[uint8]int64)
                for job := range ctx.Jobs(node.Id, nncp.TRx) {
                        if *showPkt {
                                jobPrint(nncp.TRx, job)
@@ -105,6 +107,13 @@ func main() {
                        rxNums[job.PktEnc.Nice] = rxNums[job.PktEnc.Nice] + 1
                        rxBytes[job.PktEnc.Nice] = rxBytes[job.PktEnc.Nice] + job.Size
                }
+               for job := range ctx.JobsNoCK(node.Id) {
+                       if *showPkt {
+                               jobPrint(nncp.TRx, job)
+                       }
+                       noCKNums[job.PktEnc.Nice] = noCKNums[job.PktEnc.Nice] + 1
+                       noCKBytes[job.PktEnc.Nice] = noCKBytes[job.PktEnc.Nice] + job.Size
+               }
                txNums := make(map[uint8]int)
                txBytes := make(map[uint8]int64)
                for job := range ctx.Jobs(node.Id, nncp.TTx) {
@@ -118,17 +127,26 @@ func main() {
                for nice = 1; nice > 0; nice++ {
                        rxNum, rxExists := rxNums[nice]
                        txNum, txExists := txNums[nice]
-                       if !(rxExists || txExists) {
+                       noCKNum, noCKExists := noCKNums[nice]
+                       if !(rxExists || txExists || noCKExists) {
                                continue
                        }
                        fmt.Printf(
-                               "\tnice:% 4s | Rx: % 10s, % 3d pkts | Tx: % 10s, % 3d pkts\n",
+                               "\tnice:% 4s | Rx: % 10s, % 3d pkts | Tx: % 10s, % 3d pkts",
                                nncp.NicenessFmt(nice),
                                humanize.IBytes(uint64(rxBytes[nice])),
                                rxNum,
                                humanize.IBytes(uint64(txBytes[nice])),
                                txNum,
                        )
+                       if noCKExists {
+                               fmt.Printf(
+                                       " | NoCK: % 10s, % 3d pkts",
+                                       humanize.IBytes(uint64(noCKBytes[nice])),
+                                       noCKNum,
+                               )
+                       }
+                       fmt.Printf("\n")
                }
        }
 }