github.com/anacrolix/torrent@v1.61.0/expvar.go (about) 1 package torrent 2 3 import ( 4 "expvar" 5 ) 6 7 func init() { 8 torrent.Set("peers supporting extension", &peersSupportingExtension) 9 torrent.Set("chunks received", &ChunksReceived) 10 } 11 12 // I could move a lot of these counters to their own file, but I suspect they 13 // may be attached to a Client someday. 14 var ( 15 torrent = expvar.NewMap("torrent") 16 peersSupportingExtension expvar.Map 17 // This could move at any time. It contains counts of chunks received and the conditions they 18 // were received. 19 ChunksReceived expvar.Map 20 21 pieceHashedCorrect = expvar.NewInt("pieceHashedCorrect") 22 pieceHashedNotCorrect = expvar.NewInt("pieceHashedNotCorrect") 23 24 completedHandshakeConnectionFlags = expvar.NewMap("completedHandshakeConnectionFlags") 25 // Count of connections to peer with same client ID. 26 connsToSelf = expvar.NewInt("connsToSelf") 27 receivedKeepalives = expvar.NewInt("receivedKeepalives") 28 // Requests received for pieces we don't have. 29 requestsReceivedForMissingPieces = expvar.NewInt("requestsReceivedForMissingPieces") 30 requestedChunkLengths = expvar.NewMap("requestedChunkLengths") 31 32 messageTypesReceived = expvar.NewMap("messageTypesReceived") 33 34 concurrentChunkWrites = expvar.NewInt("torrentConcurrentChunkWrites") 35 )