Summary: | upload/download speed calculated incorrectly | ||
---|---|---|---|
Product: | [Applications] ktorrent | Reporter: | Michal Suchanek <hramrach> |
Component: | general | Assignee: | Joris Guisson <joris.guisson> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Other | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Michal Suchanek
2006-07-20 13:28:58 UTC
Wow, we haven't seen that before, can you try 2.0rc1 and see if it still happens with that release ? Sort of a confirmation on the latest svn 565093, i did: Remove 39% completed torrent, leave downloaded data untouched->> download torrent again and point to the old folder--> checking chunks...->> viewable: 4500+ KB/s (connection limit is 1200K, downloading with 60K on this torrent) and counting down. yes, the torrents are probably imported. I cannot build rc1 here. SVN commit 565881 by guisson: Made sure in case of import, the number of imported bytes gets saved properly, so that average speeds are OK. BUG:131109 M +3 -0 torrentcontrol.cpp --- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentcontrol.cpp #565880:565881 @@ -1152,7 +1152,10 @@ // update chunk manager cman->dataChecked(dc->getDownloaded()); if (auto_import) + { down->recalcDownloaded(); + stats.imported_bytes = down->bytesDownloaded(); + } } delete dc; // update the status This does not fix the problem for me. I tried importing a torrent and started seeding. In a few minutes the current speed displayed in ktorrent went to 800 KB/s, while the peak speed in network monitor was something between 50-160 KB/s. The average speed displayed in ktorrent was between 5.0-5.3 KB/s, and the current speed kept growing. Closing ktorrent had negligible impact on the speed displayed in the network monitor. I see no abnormal speed increases after an import (which should have nothing to do with the speed calculation). Does this only happen with imports ? no, I tried to get a new torrent, started downloading, and the same thing happens for download. Only the numbers do not get astronomic so fast because downloading is slower. The net monitor reports about 10 KB/s peak, and the ktorrent average is 8KB/s. ktorrent current is 170KB/s and growing. I am using 2.0rc1 with the patch here and the patch to fix build. Hmm, maybe there is some timing related function which behaves differently on OS X. SVN commit 566936 by guisson: Fixed bug in speed calculation. BUG: 131109 M +2 -2 apps/ktorrent/ktorrent.cpp M +1 -1 libktorrent/net/speed.cpp M +8 -8 plugins/scheduler/bwscheduler.cpp --- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrent.cpp #566935:566936 @@ -280,8 +280,8 @@ PeerManager::setMaxTotalConnections(Settings::maxTotalConnections()); // UploadCap::instance().setMaxSpeed(Settings::maxUploadRate() * 1024); // DownloadCap::instance().setMaxSpeed(Settings::maxDownloadRate()*1024); - net::SocketMonitor::setDownloadCap(Settings::maxDownloadRate()*1000); - net::SocketMonitor::setUploadCap(Settings::maxUploadRate()*1000); + net::SocketMonitor::setDownloadCap(Settings::maxDownloadRate()*1024); + net::SocketMonitor::setUploadCap(Settings::maxUploadRate()*1024); m_core->setKeepSeeding(Settings::keepSeeding()); if (Settings::showSystemTrayIcon()) --- trunk/extragear/network/ktorrent/libktorrent/net/speed.cpp #566935:566936 @@ -72,7 +72,7 @@ else { // Out() << "bytes = " << bytes << " d = " << d << endl; - rate = (float) bytes / (d * (1.0/1024.0)); + rate = (float) bytes / (float)(d * 0.001); } } --- trunk/extragear/network/ktorrent/plugins/scheduler/bwscheduler.cpp #566935:566936 @@ -177,8 +177,8 @@ if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1000 * m_core->getMaxDownloadSpeed()); - net::SocketMonitor::setUploadCap(1000 * m_core->getMaxUploadSpeed()); + net::SocketMonitor::setDownloadCap(1024 * m_core->getMaxDownloadSpeed()); + net::SocketMonitor::setUploadCap(1024 * m_core->getMaxUploadSpeed()); break; case CAT_FIRST: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to FIRST category" << endl; @@ -187,8 +187,8 @@ if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1000 * m_schedule.getDownload(0)); - net::SocketMonitor::setUploadCap(1000 * m_schedule.getUpload(0)); + net::SocketMonitor::setDownloadCap(1024 * m_schedule.getDownload(0)); + net::SocketMonitor::setUploadCap(1024 * m_schedule.getUpload(0)); break; case CAT_SECOND: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to SECOND category" << endl; @@ -197,8 +197,8 @@ if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1000 * m_schedule.getDownload(1)); - net::SocketMonitor::setUploadCap(1000 * m_schedule.getUpload(1)); + net::SocketMonitor::setDownloadCap(1024 * m_schedule.getDownload(1)); + net::SocketMonitor::setUploadCap(1024 * m_schedule.getUpload(1)); break; case CAT_THIRD: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to THIRD category" << endl; @@ -207,8 +207,8 @@ if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1000 * m_schedule.getDownload(2)); - net::SocketMonitor::setUploadCap(1000 * m_schedule.getUpload(2)); + net::SocketMonitor::setDownloadCap(1024 * m_schedule.getDownload(2)); + net::SocketMonitor::setUploadCap(1024 * m_schedule.getUpload(2)); break; case CAT_OFF: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to OFF" << endl; hmm, it wasn't actually the rc1 package. The package manager does no longer automatically install packages it builds for some reason. rc1 and current svn do not work for me at all, they do not genereate any network traffic at all. Huh ? Get rid of all installed stuff of KT and do a fresh install, so that we can be sure that you are not loading the wrong libraries or plugins. with 2.0 and later this appears to work for me as well. I compiled KTorrent 2.1dev04-02-07 and this bug is still present. Torrent speed shown in the gui grows step by step to the infinite. Sometimes KTorrent shows the same speed for each node in peers view, and of course this speed is exactly the same is shown in the torrents general view. Sometimes KTorrent shows speed "0" in each node in peers view except one, and of course this speed is exactly the same is shown in the torrents view. But this should be correct. Sometimes KTorrent shows the same speed for each node in peers view that have the same torrent client. Average speeds are correct. We have been unable to reproduce this. I just noticed this error on my setup after reinstalling Linux. I think I'm using the exact same version of Ktorrent as before (2.2.2), but now the download/upload speed quickly increases just as the original poster of this bug. I have been unable to reproduce this on any other computer. I've tried recompiling several times but the error remains. If i can send any more info that would be helpful to debug this please let me know. |