From e5e90aeae5f1c05a50eac3ccc4f2e19d56c18bdc Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 19 Oct 2021 12:48:38 +0200 Subject: [PATCH] replay: improve download prints --- selfdrive/ui/replay/util.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/replay/util.cc b/selfdrive/ui/replay/util.cc index 5ffc4c0250..d350c144b9 100644 --- a/selfdrive/ui/replay/util.cc +++ b/selfdrive/ui/replay/util.cc @@ -125,7 +125,10 @@ bool httpMultiPartDownload(const std::string &url, const std::string &target_fil if ((ts - last_print_ts) > 2 * 1000) { if (enable_http_logging && last_print_ts > 0) { size_t average = (total_written - prev_total_written) / ((ts - last_print_ts) / 1000.); - std::cout << "downloading segments at " << formattedDataSize(average) << "/S" << std::endl; + int progress = std::min(100, 100.0 * (double)written / (double)content_length); + + size_t idx = url.find("?"); + std::cout << "downloading " << (idx == std::string::npos ? url : url.substr(0, idx)) << " - " << progress << "% (" << formattedDataSize(average) << "/s)" << std::endl; } prev_total_written = total_written; last_print_ts = ts;