[mirrorbrain-commits] [opensuse-svn] r7583 - in trunk/tools/download-redirector-v2/mirrordoctor: . mb

From: Novell Forge SVN <noreply_at_novell.com>
Date: Mon, 22 Jun 2009 16:28:34 -0600 (MDT)
Author: poeml
Date: 2009-06-22 16:28:32 -0600 (Mon, 22 Jun 2009)
New Revision: 7583

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mb/util.py
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb scan:
- implement a primitive timer to measure the time used for scanning.


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mb/util.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mb/util.py	2009-06-22 21:57:16 UTC (rev 7582)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mb/util.py	2009-06-22 22:28:32 UTC (rev 7583)
_at_@ -105,3 +105,24 @@
                 return
             else:
                 pass
+
+import time
+
+t_start = 0
+#_at_staticmethod
+def timer_start():
+    global t_start
+    t_start = time.time()
+
+def timer_elapsed():
+    global t_start
+
+    t_end = time.time()
+    t_delta = int(t_end - t_start)
+    if t_delta > 60 * 60: 
+        return '%s hours' % round((t_delta / 60 / 60), 1)
+    elif t_delta > 60:
+        return '%s minutes' % round((t_delta / 60), 1)
+    else:
+        return '%s seconds' % t_delta
+

Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-06-22 21:57:16 UTC (rev 7582)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-06-22 22:28:32 UTC (rev 7583)
_at_@ -610,10 +610,13 @@
         ${cmd_option_list}
         """
         from sqlobject.sqlbuilder import AND
+        import mb.util
         import textwrap
         import mb.testmirror
         mb.testmirror.dont_use_proxies()
 
+        mb.util.timer_start()
+
         cmd = []
         cmd.append(opts.scanner or '/usr/bin/scanner')
 
_at_@ -709,6 +712,7 @@
             print textwrap.fill(', '.join(mirrors_skipped),
                                 initial_indent='    ', subsequent_indent='  ')
 
+        print 'Completed in', mb.util.timer_elapsed()
 
 
     def do_score(self, subcmd, opts, *args):

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Mon Jun 22 2009 - 22:29:13 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT