mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 23:52:31 -06:00
Performance improvement on ARM
This commit is contained in:
@@ -88,12 +88,12 @@ qlonglong QTorrentHandle::next_announce_s() const {
|
||||
return torrent_handle::status().next_announce.total_seconds();
|
||||
}
|
||||
|
||||
float QTorrentHandle::progress() const {
|
||||
qreal QTorrentHandle::progress() const {
|
||||
if(!torrent_handle::status().total_wanted)
|
||||
return 0.;
|
||||
if (torrent_handle::status().total_wanted_done == torrent_handle::status().total_wanted)
|
||||
return 1.;
|
||||
float progress = (float)torrent_handle::status().total_wanted_done/(float)torrent_handle::status().total_wanted;
|
||||
qreal progress = (float)torrent_handle::status().total_wanted_done/(float)torrent_handle::status().total_wanted;
|
||||
Q_ASSERT(progress >= 0. && progress <= 1.);
|
||||
return progress;
|
||||
}
|
||||
@@ -159,11 +159,11 @@ size_type QTorrentHandle::total_wanted() const {
|
||||
return torrent_handle::status().total_wanted;
|
||||
}
|
||||
|
||||
float QTorrentHandle::download_payload_rate() const {
|
||||
qreal QTorrentHandle::download_payload_rate() const {
|
||||
return torrent_handle::status().download_payload_rate;
|
||||
}
|
||||
|
||||
float QTorrentHandle::upload_payload_rate() const {
|
||||
qreal QTorrentHandle::upload_payload_rate() const {
|
||||
return torrent_handle::status().upload_payload_rate;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
//
|
||||
QString hash() const;
|
||||
QString name() const;
|
||||
float progress() const;
|
||||
qreal progress() const;
|
||||
libtorrent::bitfield pieces() const;
|
||||
QString current_tracker() const;
|
||||
bool is_paused() const;
|
||||
@@ -66,8 +66,8 @@ public:
|
||||
int num_pieces() const;
|
||||
libtorrent::size_type total_wanted_done() const;
|
||||
libtorrent::size_type total_wanted() const;
|
||||
float download_payload_rate() const;
|
||||
float upload_payload_rate() const;
|
||||
qreal download_payload_rate() const;
|
||||
qreal upload_payload_rate() const;
|
||||
int num_connections() const;
|
||||
int connections_limit() const;
|
||||
int num_peers() const;
|
||||
|
||||
@@ -43,7 +43,7 @@ class SpeedSample {
|
||||
public:
|
||||
SpeedSample(){}
|
||||
void addSample(int s);
|
||||
float average() const;
|
||||
qreal average() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
@@ -83,7 +83,7 @@ void SpeedSample::addSample(int s)
|
||||
m_speedSamples.removeFirst();
|
||||
}
|
||||
|
||||
float SpeedSample::average() const
|
||||
qreal SpeedSample::average() const
|
||||
{
|
||||
if(m_speedSamples.empty()) return 0;
|
||||
qlonglong sum = 0;
|
||||
@@ -114,7 +114,7 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const
|
||||
QMutexLocker locker(&m_mutex);
|
||||
QTorrentHandle h = m_session->getTorrentHandle(hash);
|
||||
if(h.is_paused() || !m_samples.contains(hash)) return -1;
|
||||
const float speed_average = m_samples.value(hash).average();
|
||||
const qreal speed_average = m_samples.value(hash).average();
|
||||
if(speed_average == 0) return -1;
|
||||
return (h.total_wanted() - h.total_done()) / speed_average;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user