diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-10-25 23:33:45 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-10-25 23:33:45 +0900 |
| commit | 0ecfa19925453e3e4bf8ca947dc72a597654e401 (patch) | |
| tree | 09e2a91ca926e58489bee5c4ba2ae3ba2ba102de /src/DefaultBtAnnounce.cc | |
| parent | 46bdaf0e8dae04d223d9b8b65ac80bc0773d8398 (diff) | |
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.
Diffstat (limited to 'src/DefaultBtAnnounce.cc')
| -rw-r--r-- | src/DefaultBtAnnounce.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/DefaultBtAnnounce.cc b/src/DefaultBtAnnounce.cc index 4f3638f2..6a9cc713 100644 --- a/src/DefaultBtAnnounce.cc +++ b/src/DefaultBtAnnounce.cc @@ -141,7 +141,7 @@ std::string DefaultBtAnnounce::getAnnounceUrl() { if(!btRuntime_->lessThanMinPeers() || btRuntime_->isHalt()) { numWant = 0; } - TransferStat stat = peerStorage_->calculateStat(); + NetStat& stat = downloadContext_->getNetStat(); int64_t left = pieceStorage_->getTotalLength()-pieceStorage_->getCompletedLength(); // Use last 8 bytes of peer ID as a key |
