@@ -138,7 +138,6 @@ func (s *socket) getNewBlocks() {
138138}
139139func (s * socket ) reportStats () {
140140 var totalPackets , totalDrops uint64
141- var totalNotSent float64
142141 // getting statistics returns the stats since the last invocation. We clear
143142 // counters by doing an initial read we ignore.
144143 s .stats ()
@@ -150,34 +149,19 @@ func (s *socket) reportStats() {
150149 log .Printf ("error getting statistics: %v" , err )
151150 } else {
152151 client_status := "delivered to client"
153- totalPackets += uint64 (stats .tp_packets )
154- totalDrops += uint64 (stats .tp_drops )
155-
156-
157- totalNotSent = float64 (stats .tp_packets ) - (float64 (stats .tp_packets ) * (float64 (len (s .currentConns )) / (float64 (s .conf .NumberOfClients * s .conf .FanoutSize ))))
158-
159152 if len (s .currentConns ) <= 0 {
160153 client_status = "discarded by testimony"
161154 }
162155 if s .conf .NumberOfClients == 0 {
163- vlog .V (1 , " Connected - %d clients" , len (s .currentConns ))
164-
165- } else if len (s .currentConns ) > s .conf .NumberOfClients {
166- vlog .V (1 , " Connected - %d clients, but waiting only for %d connection(s)" , len (s .currentConns ), s .conf .NumberOfClients )
156+ vlog .V (1 , "%v stats: Connected - %d clients" , s , len (s .currentConns ))
167157 } else {
168- totalNotSent = float64 (stats .tp_packets ) - (float64 (stats .tp_packets ) * (float64 (len (s .currentConns )) / (float64 (s .conf .NumberOfClients * s .conf .FanoutSize ))))
169- vlog .V (1 , " Connected - %d clients, still not connected - %d, therefore %v packets loosed" , len (s .currentConns ), (s .conf .NumberOfClients * s .conf .FanoutSize )- len (s .currentConns ), totalNotSent )
170-
171- } else {
172- vlog .V (1 , " Connected - %d clients, still not connected - %d, therefore %v packets loosed " , len (s .currentConns ), (s .conf .NumberOfClients * s .conf .FanoutSize )- len (s .currentConns ), totalNotSent )
173-
158+ vlog .V (1 , "%v stats: connected - %d clients, still not connected - %d, therefore %v packets loosed for each unconnected client" , s , len (s .currentConns ), s .conf .NumberOfClients - len (s .currentConns ), stats .tp_packets )
174159 }
175160 vlog .V (1 , " %v stats: %d packets %v (%.02fpps), %d dropped in kernel (%.02fpps) (%.02f%% dropped) since last log, %d packets, %d drops total (%.02f%% dropped)" ,
176161 s , stats .tp_packets , client_status , float64 (stats .tp_packets )/ seconds ,
177162 stats .tp_drops , float64 (stats .tp_drops )/ seconds ,
178163 float64 (stats .tp_drops )/ float64 (stats .tp_drops + stats .tp_packets )* 100 ,
179164 totalPackets , totalDrops , float64 (totalDrops )/ float64 (totalPackets + totalDrops )* 100 )
180-
181165 }
182166
183167 }
0 commit comments