]> arthur.barton.de Git - bup.git/blobdiff - cmd/memtest-cmd.py
rm: move core code to bup.rm module
[bup.git] / cmd / memtest-cmd.py
index 171d66e8f1ce802d020842b77881f5f9425eeb5b..c4c531e22928c5c95cf03f6d75adaa3a7edd1c96 100755 (executable)
@@ -1,10 +1,19 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
+
 import sys, re, struct, time, resource
-from bup import git, options, _helpers
-from bup.helpers import *
+
+from bup import git, bloom, midx, options, _helpers
+from bup.helpers import handle_ctrl_c
+
 
 handle_ctrl_c()
 
+
 _linux_warned = 0
 def linux_memstat():
     global _linux_warned
@@ -12,7 +21,7 @@ def linux_memstat():
     d = {}
     try:
         f = open('/proc/self/status')
-    except IOError, e:
+    except IOError as e:
         if not _linux_warned:
             log('Warning: %s\n' % e)
             _linux_warned = 1
@@ -103,7 +112,16 @@ for c in xrange(opt.cycles):
             assert(not m.exists(bin))
     report((c+1)*opt.number)
 
-print ('%d objects searched in %d steps: avg %.3f steps/object' 
-       % (git._total_searches, git._total_steps,
-          git._total_steps*1.0/git._total_searches))
+if bloom._total_searches:
+    print ('bloom: %d objects searched in %d steps: avg %.3f steps/object' 
+           % (bloom._total_searches, bloom._total_steps,
+              bloom._total_steps*1.0/bloom._total_searches))
+if midx._total_searches:
+    print ('midx: %d objects searched in %d steps: avg %.3f steps/object' 
+           % (midx._total_searches, midx._total_steps,
+              midx._total_steps*1.0/midx._total_searches))
+if git._total_searches:
+    print ('idx: %d objects searched in %d steps: avg %.3f steps/object' 
+           % (git._total_searches, git._total_steps,
+              git._total_steps*1.0/git._total_searches))
 print 'Total time: %.3fs' % (time.time() - start)