From: Matt Joiner Date: Mon, 20 Sep 2021 04:17:58 +0000 (+1000) Subject: cmd/torrent: Dump download statistics X-Git-Tag: v1.32.0~29^2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=00a730042145491e05d6224b806d2ac447f3dfd2;p=btrtrc.git cmd/torrent: Dump download statistics --- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 624c2a4e..757ecdc7 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -369,6 +369,15 @@ func downloadErr(flags downloadFlags) error { <-stop.C() } } + spew.Dump(expvar.Get("torrent").(*expvar.Map).Get("chunks received")) + spew.Dump(client.ConnStats()) + clStats := client.ConnStats() + sentOverhead := clStats.BytesWritten.Int64() - clStats.BytesWrittenData.Int64() + log.Printf( + "client read %v, %v was useful data. sent %v non-data bytes", + humanize.Bytes(uint64(clStats.BytesRead.Int64())), + 100*float64(clStats.BytesReadUsefulData.Int64())/float64(clStats.BytesRead.Int64()), + humanize.Bytes(uint64(sentOverhead))) return nil }