summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorZdeněk Pavlas <zpavlas@redhat.com>2012-08-27 14:07:39 +0200
committerZdeněk Pavlas <zpavlas@redhat.com>2012-08-29 14:59:52 +0200
commit4db7b23949ce3628f0e0e65c7c56900fef2ea78a (patch)
tree93738dcaf9630fb81d79d27e08cbeef1787d067d /scripts
parentf231491a175b12638ae94713db9bbfe60d985db1 (diff)
downloadurlgrabber-4db7b23949ce3628f0e0e65c7c56900fef2ea78a.tar.gz
timedhosts: Measure bandwidth, ignore latency
Use only file offsets and timestamps at the first and last call of PyCurlFileObject._retrieve(). Should help 851178.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/urlgrabber-ext-down11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/urlgrabber-ext-down b/scripts/urlgrabber-ext-down
index 3da55a4..3dafb12 100755
--- a/scripts/urlgrabber-ext-down
+++ b/scripts/urlgrabber-ext-down
@@ -55,18 +55,21 @@ def main():
if opts.progress_obj:
opts.progress_obj = ProxyProgress()
opts.progress_obj._id = cnt
- tm = time.time()
+
+ dlsz = dltm = 0
try:
fo = PyCurlFileObject(opts.url, opts.filename, opts)
fo._do_grab()
fo.fo.close()
size = fo._amount_read
- dlsz = size - fo._reget_length
+ if fo._tm_last:
+ dlsz = fo._tm_last[0] - fo._tm_first[0]
+ dltm = fo._tm_last[1] - fo._tm_first[1]
ug_err = 'OK'
except URLGrabError, e:
- size = dlsz = 0
+ size = 0
ug_err = '%d %s' % e.args
- write('%d %d %d %.3f %s\n', opts._id, size, dlsz, time.time() - tm, ug_err)
+ write('%d %d %d %.3f %s\n', opts._id, size, dlsz, dltm, ug_err)
if __name__ == '__main__':
main()