Track concurrent chunk writes

This commit is contained in:
Matt Joiner 2019-06-13 12:18:08 +10:00
parent 7ce45366f5
commit 53be473486
2 changed files with 4 additions and 0 deletions

View File

@ -1326,6 +1326,8 @@ func (c *connection) receiveChunk(msg *pp.Message) error {
err := func() error {
cl.unlock()
defer cl.lock()
concurrentChunkWrites.Add(1)
defer concurrentChunkWrites.Add(-1)
// Write the chunk out. Note that the upper bound on chunk writing
// concurrency will be the number of connections. We write inline with
// receiving the chunk (with this lock dance), because we want to

View File

@ -49,4 +49,6 @@ var (
pieceInclinationsReused = expvar.NewInt("pieceInclinationsReused")
pieceInclinationsNew = expvar.NewInt("pieceInclinationsNew")
pieceInclinationsPut = expvar.NewInt("pieceInclinationsPut")
concurrentChunkWrites = expvar.NewInt("torrentConcurrentChunkWrites")
)