X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fnncp%2Fcmd%2Fnncp-stat%2Fmain.go;h=bcda35526921efbf6f4ee535eaf4586306d8a33b;hb=dd92823db3d72fb21a4c712a7fb052dce16443dd;hp=94a0bb1fd2557959393041c7f6bf86ad5c084d11;hpb=a63abe6f26fc5f4ed6e37ce02370065200d8daea;p=nncp.git diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go index 94a0bb1..bcda355 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go @@ -1,11 +1,10 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2018 Sergey Matveev +Copyright (C) 2016-2019 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -// Show queued NNCP Rx/Tx stats +// Show queued NNCP Rx/Tx stats. package main import ( @@ -99,18 +98,19 @@ func main() { txBytes[job.PktEnc.Nice] = txBytes[job.PktEnc.Nice] + job.Size } fmt.Println(node.Name) - for nice := 0; nice < 256; nice++ { - rxNum, rxExists := rxNums[uint8(nice)] - txNum, txExists := txNums[uint8(nice)] + var nice uint8 + for nice = 1; nice > 0; nice++ { + rxNum, rxExists := rxNums[nice] + txNum, txExists := txNums[nice] if !(rxExists || txExists) { continue } fmt.Printf( - "\tnice:% 3d | Rx: % 10s, % 3d pkts | Tx: % 10s, % 3d pkts\n", - nice, - humanize.IBytes(uint64(rxBytes[uint8(nice)])), + "\tnice:% 4s | Rx: % 10s, % 3d pkts | Tx: % 10s, % 3d pkts\n", + nncp.NicenessFmt(nice), + humanize.IBytes(uint64(rxBytes[nice])), rxNum, - humanize.IBytes(uint64(txBytes[uint8(nice)])), + humanize.IBytes(uint64(txBytes[nice])), txNum, ) }