cmd/torrent/main.go | 8 ++++++++ diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 260f51d28931130598f9c84e7703d3d6baf2b5a3..c2e65801c92a5189c3425d857179c5557de835da 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -347,6 +347,7 @@ http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { client.WriteStatus(w) }) err = addTorrents(client, flags) + started := time.Now() if err != nil { return fmt.Errorf("adding torrents: %w", err) } @@ -356,6 +357,13 @@ log.Print("downloaded ALL the torrents") } else { err = errors.New("y u no complete torrents?!") } + clientConnStats := client.ConnStats() + log.Printf("average download rate: %v", + humanize.Bytes(uint64( + time.Duration( + clientConnStats.BytesReadUsefulData.Int64(), + )*time.Second/time.Since(started), + ))) if flags.Seed { if len(client.Torrents()) == 0 { log.Print("no torrents to seed")