From 53be4734869699c621f2c969a5a9b330766ddc87 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 13 Jun 2019 12:18:08 +1000 Subject: [PATCH] Track concurrent chunk writes --- connection.go | 2 ++ global.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/connection.go b/connection.go index 28152d5a..6d11f8ab 100644 --- a/connection.go +++ b/connection.go @@ -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 diff --git a/global.go b/global.go index b66dd9dd..b9950cb2 100644 --- a/global.go +++ b/global.go @@ -49,4 +49,6 @@ var ( pieceInclinationsReused = expvar.NewInt("pieceInclinationsReused") pieceInclinationsNew = expvar.NewInt("pieceInclinationsNew") pieceInclinationsPut = expvar.NewInt("pieceInclinationsPut") + + concurrentChunkWrites = expvar.NewInt("torrentConcurrentChunkWrites") ) -- 2.48.1