r401 - in /debtorrent/trunk: DebTorrent/BT1/AptListener.py DebTorrent/BT1/Statistics.py DebTorrent/CurrentRateMeasure.py DebTorrent/download_bt1.py DebTorrent/launchmanycore.py debian/changelog
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Sat Jul 26 00:36:45 UTC 2008
Author: camrdale-guest
Date: Sat Jul 26 00:36:45 2008
New Revision: 401
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=401
Log:
Add display of amount downloaded by HTTP to the info page,
thanks to Steve Cotton for the fix (Closes: #488415)
Modified:
debtorrent/trunk/DebTorrent/BT1/AptListener.py
debtorrent/trunk/DebTorrent/BT1/Statistics.py
debtorrent/trunk/DebTorrent/CurrentRateMeasure.py
debtorrent/trunk/DebTorrent/download_bt1.py
debtorrent/trunk/DebTorrent/launchmanycore.py
debtorrent/trunk/debian/changelog
Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=401&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Sat Jul 26 00:36:45 2008
@@ -275,11 +275,11 @@
'<th align="right">distributed copies</th>\n' \
'<th align="right">download/<br>\n' \
'upload</th>\n' \
- '<th align="right">downloaded/<br>\n' \
+ '<th align="right">downloaded (HTTP)/<br>\n' \
'uploaded</th>\n' \
'<th align="right">size</th>\n' \
'<th align="right">time remaining</th>\n' \
- '<th>last error message</th>\n' \
+ '<th>last error message</th>\n' \
'</tr>\n')
# Get the data from the statistics gatherer
@@ -290,7 +290,7 @@
# Display a table row for each running torrent
for x in data:
( name, hash, status, progress, peers, seeds, seedsmsg, dist,
- uprate, dnrate, upamt, dnamt, size, t, msg ) = x
+ uprate, dnrate, upamt, dnamt, httpdnamt, size, t, msg ) = x
if self.allow_get:
linkname = '<a href="/file?info_hash=' + quote(hash) + '">' + name + '</a>'
@@ -307,13 +307,13 @@
'<td align="right">%.3f</td>\n' \
'<td align="right">%0.1fK/s<br>\n' \
'%0.1fK/s</td>\n' \
- '<td align="right">%s<br>\n' \
+ '<td align="right">%s (%s)<br>\n' \
'%s</td>\n' \
'<td align="right">%s</td>\n' \
'<td align="right">%s</td>\n' \
'<td>%s</td></tr>\n' \
% (linkname, b2a_hex(hash), status, progress, peers, seeds,
- dist, dnrate/1000, uprate/1000, size_format(dnamt),
+ dist, dnrate/1000, uprate/1000, size_format(dnamt), size_format(httpdnamt),
size_format(upamt), size_format(size), hours(t), msg))
s.write('</table>\n' \
@@ -560,7 +560,7 @@
for x in data:
( name, hash, status, progress, peers, seeds, seedsmsg, dist,
- uprate, dnrate, upamt, dnamt, size, t, msg ) = x
+ uprate, dnrate, upamt, dnamt, httpdnamt, size, t, msg ) = x
total_size += size
total_dnrate += dnrate
Modified: debtorrent/trunk/DebTorrent/BT1/Statistics.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Statistics.py?rev=401&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Statistics.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Statistics.py Sat Jul 26 00:36:45 2008
@@ -162,6 +162,7 @@
s = Statistics_Response()
s.upTotal = self.upmeasure.get_total()
s.downTotal = self.downmeasure.get_total()
+ s.httpDownTotal = self.downmeasure.get_http_subtotal()
s.last_failed = self.rerequest_lastfailed()
s.external_connection_made = self.connecter.external_connection_made
if s.downTotal > 0:
Modified: debtorrent/trunk/DebTorrent/CurrentRateMeasure.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/CurrentRateMeasure.py?rev=401&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/CurrentRateMeasure.py (original)
+++ debtorrent/trunk/DebTorrent/CurrentRateMeasure.py Sat Jul 26 00:36:45 2008
@@ -10,7 +10,14 @@
class Measure:
"""The measurement of one rate.
-
+
+ This keeps track of both the current rate and the total
+ amount of data sent or received.
+
+ For DebTorrent, it can keep a subtotal of the amount of data
+ transferred via HTTP. Currently the HTTP rate is not
+ calculated, just the total.
+
@type max_rate_period: C{float}
@ivar max_rate_period: maximum amount of time to guess the current rate
estimate represents
@@ -22,10 +29,12 @@
@ivar rate: the latest calculated rate
@type total: C{long}
@ivar total: the total amount that went in to calculating the rate
+ @type httptotal: C{long}
+ @ivar httptotal: the total amount of HTTP data (also included in the total)
"""
- def __init__(self, max_rate_period, fudge = 1, saved_total = 0L):
+ def __init__(self, max_rate_period, fudge = 1, saved_total = 0L, http_total = 0L):
"""Initialize the measurement.
@type max_rate_period: C{float}
@@ -37,6 +46,8 @@
@type saved_total: C{long}
@param saved_total: the saved amount measured from a previous run
(optional, defaults to 0)
+ @param http_total: the saved amount measured from a previous run
+ (optional, defaults to 0)
"""
@@ -45,6 +56,7 @@
self.last = self.ratesince
self.rate = 0.0
self.total = long(saved_total)
+ self.httptotal = long(http_total)
def update_rate(self, amount):
"""Update the rate with new data.
@@ -62,6 +74,20 @@
if self.ratesince < t - self.max_rate_period:
self.ratesince = t - self.max_rate_period
+ def update_http_rate(self, amount):
+ """Update the rate with new data.
+
+ This new data is added to the figures returned by all of
+ C{get_rate}, C{get_total} and C{get_http_subtotal}.
+
+ @type amount: C{long}
+ @param amount: the new data to add into the rate calculation
+
+ """
+
+ self.httptotal += amount
+ self.update_rate(amount)
+
def get_rate(self):
"""Get the current rate measurement.
@@ -107,4 +133,14 @@
"""
- return self.total
+ return self.total
+
+ def get_http_subtotal(self):
+ """Get the amount transferred via HTTP only
+
+ @rtype: C{float}
+ @return: the total amount
+
+ """
+
+ return self.httptotal
Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=401&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Sat Jul 26 00:36:45 2008
@@ -905,7 +905,7 @@
else:
self.pickled_data['resume data'] = {'priority': {}, 'files': {}}
must_find_files = True
- self.pickled_data['stats'] = {'upload': 0L, 'download': 0L}
+ self.pickled_data['stats'] = {'upload': 0L, 'download': 0L, 'download_http': 0L}
self.pickled_data['version'] = 1
# Initialize the saved state it if it wasn't found
@@ -913,7 +913,7 @@
must_find_files = True
self.pickled_data = {}
self.pickled_data['resume data'] = {'priority': {}, 'files': {}}
- self.pickled_data['stats'] = {'upload': 0L, 'download': 0L}
+ self.pickled_data['stats'] = {'upload': 0L, 'download': 0L, 'download_http': 0L}
self.pickled_data['version'] = 1
enabled_files = []
@@ -1099,7 +1099,7 @@
"""
- self.downmeasure.update_rate(x)
+ self.downmeasure.update_http_rate(x)
self.ratemeasure.data_came_in(x)
self.downloader.external_data_received(x)
@@ -1139,7 +1139,7 @@
@return: whether the engines were started
"""
-
+
if self.doneflag.isSet():
return False
@@ -1162,9 +1162,13 @@
total_up = long(self.pickled_data['stats']['upload'])
total_down = long(self.pickled_data['stats']['download'])
+ # The total_http stat isn't in files created with debtorrent-0.1.8
+ total_http = 0L;
+ if self.pickled_data['stats'].has_key('download_http'):
+ total_http = long(self.pickled_data['stats']['download_http'])
self.upmeasure = Measure(self.config['max_rate_period'],
self.config['upload_rate_fudge'], saved_total = total_up)
- self.downmeasure = Measure(self.config['max_rate_period'], saved_total = total_down)
+ self.downmeasure = Measure(self.config['max_rate_period'], saved_total = total_down, http_total = total_http)
if ratelimiter:
self.ratelimiter = ratelimiter
@@ -1325,7 +1329,8 @@
torrentdata = {}
torrentdata['version'] = 1
torrentdata['stats'] = {'upload': self.upmeasure.get_total(),
- 'download': self.downmeasure.get_total()}
+ 'download': self.downmeasure.get_total(),
+ 'download_http': self.downmeasure.get_http_subtotal()}
if not self.failed:
self.fileselector.finish()
torrentdata['resume data'] = self.fileselector.pickle()
Modified: debtorrent/trunk/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/launchmanycore.py?rev=401&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/launchmanycore.py (original)
+++ debtorrent/trunk/DebTorrent/launchmanycore.py Sat Jul 26 00:36:45 2008
@@ -449,6 +449,7 @@
dnrate = 0.0
upamt = 0
dnamt = 0
+ httpdnamt = 0
t = 0
if d.is_dead():
status = 'stopped'
@@ -483,6 +484,7 @@
uprate = stats['up']
upamt = s.upTotal
dnamt = s.downTotal
+ httpdnamt = s.httpDownTotal
size = stats['wanted']
if d.is_dead() or d.status_errtime+300 > clock():
@@ -491,7 +493,7 @@
msg = ''
data.append(( name, id, status, progress, peers, seeds, seedsmsg,
- dist, uprate, dnrate, upamt, dnamt, size, t, msg ))
+ dist, uprate, dnrate, upamt, dnamt, httpdnamt, size, t, msg ))
return data
Modified: debtorrent/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debian/changelog?rev=401&op=diff
==============================================================================
--- debtorrent/trunk/debian/changelog (original)
+++ debtorrent/trunk/debian/changelog Sat Jul 26 00:36:45 2008
@@ -3,8 +3,10 @@
* Fix download/upload stats are correct after restarting torrents,
thanks to Steve Cotton for the fix (Closes: #487829)
* Use the HTTP downloads from the mirror in parallel with peers.
+ * Add display of amount downloaded by HTTP to the info page,
+ thanks to Steve Cotton for the fix (Closes: #488415)
- -- Cameron Dale <camrdale at gmail.com> Sat, 19 Jul 2008 16:51:45 -0700
+ -- Cameron Dale <camrdale at gmail.com> Fri, 25 Jul 2008 17:35:17 -0700
debtorrent (0.1.8) unstable; urgency=low
More information about the Debtorrent-commits
mailing list