]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Track concurrent chunk writes v1.2.0
authorMatt Joiner <anacrolix@gmail.com>
Thu, 13 Jun 2019 02:18:08 +0000 (12:18 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 13 Jun 2019 02:18:24 +0000 (12:18 +1000)
connection.go
global.go

index 28152d5a60c13630423f84dcd94ef1cd523d5706..6d11f8ab1334e09e9574b9e9c3830a344e8208dd 100644 (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
index b66dd9dd816dd76cd27ceb522894190f1694da71..b9950cb2ef6d23b35ba627d40d9f1e0c12736365 100644 (file)
--- 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")
 )