[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Add debug function for time reports
Mike Massonnet
noreply at xfce.org
Sat Feb 27 00:44:08 CET 2010
Updating branch refs/heads/aria2-xml-rpc
to e8da14d2d919b7e7fadc3bd55bf82c5082e98f3e (commit)
from cd69d41cf757a98de4b3b72afc0f7fca8e4417b0 (commit)
commit e8da14d2d919b7e7fadc3bd55bf82c5082e98f3e
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Fri Feb 26 21:20:54 2010 +0100
Add debug function for time reports
src/eataria2.rb | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/eataria2.rb b/src/eataria2.rb
index 56a6f76..4074ac9 100755
--- a/src/eataria2.rb
+++ b/src/eataria2.rb
@@ -16,6 +16,14 @@ def debug(*args)
pp args
end
+def debug_time(title, time_start, time_end)
+ $time_report = Hash.new if !defined? $time_report
+ $time_report[title] = Array.new if $time_report[title] == nil
+ $time_report[title] << time_end - time_start
+ $time_report[title].delete($time_report[title].first) if $time_report[title].length > 10
+ debug("time_report", title, "now", time_end - time_start, "#{$time_report[title].length} last sec", $time_report[title].inject(:+) / $time_report[title].length)
+end
+
module Eat
@@ -453,12 +461,15 @@ class Eat::Aria2Listener < Eat::Aria2
if @is_connected
# Emit status signal for each active download
+# time_start = Time.now
tell_active.each do |status|
gid = status["gid"]
active_downloads << gid
@downloads[gid] = status
signal_emit("download_status", gid)
end
+# time_end = Time.now
+# debug_time("active downloads", time_start, time_end)
# Emit specific signal for each inactive download
(@new_downloads - active_downloads).each do |gid|
More information about the Xfce4-commits
mailing list