From: Matt Joiner Date: Thu, 13 Jun 2019 02:18:08 +0000 (+1000) Subject: Track concurrent chunk writes X-Git-Tag: v1.2.0^0 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=53be4734869699c621f2c969a5a9b330766ddc87;p=btrtrc.git Track concurrent chunk writes --- 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") )