From 0ecfa19925453e3e4bf8ca947dc72a597654e401 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 25 Oct 2012 23:33:45 +0900 Subject: Reworked download/upload statistics calculation The old implementation calculates download/upload statistics for a RequestGroup by summing up all PeerStat objects. For global statistics, those are summed together. This clearly incurs runtime penalty and we introduced some kind of caching which updates statistics every 250ms but it did not work right. This change removes all these aggregation code, and instead makes RequestGroup and RequestGroupMan objects hold NetStat object and download/upload bytes are directly calculated by thier own NetStat. This is far more simplar than the old way and less runtime penalty and brings more accuracy. --- src/DownloadCommand.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/DownloadCommand.cc') diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc index 6ac7c640..574ed663 100644 --- a/src/DownloadCommand.cc +++ b/src/DownloadCommand.cc @@ -176,6 +176,7 @@ bool DownloadCommand::executeInternal() { } getSocketRecvBuffer()->shiftBuffer(bufSize); peerStat_->updateDownloadLength(bufSize); + getDownloadContext()->updateDownloadLength(bufSize); } bool segmentPartComplete = false; // Note that GrowSegment::complete() always returns false. -- cgit