cmd/torrent: Dump download statistics

This commit is contained in:
Matt Joiner 2021-09-20 14:17:58 +10:00
parent 33883c04e4
commit 00a7300421
1 changed files with 9 additions and 0 deletions

View File

@ -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
}