Skip to content

Commit

Permalink
use new print format
Browse files Browse the repository at this point in the history
  • Loading branch information
kofemann committed Jul 2, 2019
1 parent d28e98b commit 29912db
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions mdbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# -*- coding: utf-8 -*-
#
#
# Copyright (C) 2013-2014 Deutsches Elektronen-Synchroton,
# Copyright (C) 2013-2019 Deutsches Elektronen-Synchroton,
# Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
#

'''
Simple filsystem metadata operations benchmark
Simple filesystem metadata operations benchmark
Usage: mdbench [options] <PATH>
Expand Down Expand Up @@ -110,7 +110,7 @@ def mkfile(fname, size = 0, chunk = 65536, sync = False) :
with open(fname, "wb") as f:
for n in range(n_chunks) :
f.write(bite)

f.write(payload)
if sync:
f.flush()
Expand All @@ -134,11 +134,11 @@ def bench_run(func, *args):
FILE_SIZE = 0

def usage():
print __doc__
print(__doc__)
sys.exit(1)

def main():

dir_count = DIR_COUNT
file_count = FILE_COUNT
file_size = FILE_SIZE
Expand All @@ -149,7 +149,7 @@ def main():
options, remainder = getopt.gnu_getopt(sys.argv[1:], 'f:d:s:nh', \
['files=','dirs=','size=','no-clean','no-container','help'])
except getopt.GetoptError as err:
print str(err)
print(str(err))
usage()

for opt, arg in options:
Expand Down Expand Up @@ -178,25 +178,25 @@ def main():

elapsed, result = bench_run( make_dirs, root, dir_count )
in_sec = total_seconds(elapsed)
print '%.2f dir creates per second' % (dir_count/in_sec)
print('%.2f dir creates per second' % (dir_count/in_sec))

elapsed, result = bench_run( make_files, root, dir_count, file_count , file_size)
in_sec = total_seconds(elapsed)
count = (dir_count if dir_count > 0 else 1) * file_count
print '%.2f file creates per second' % (count/in_sec)
print('%.2f file creates per second' % (count/in_sec))

elapsed, result = bench_run( stat_files, root, dir_count, file_count )
in_sec = total_seconds(elapsed)
print '%.2f file stats per second' % (count/in_sec)
print('%.2f file stats per second' % (count/in_sec))

if cleanup:
elapsed, result = bench_run( del_files, root, dir_count, file_count )
in_sec = total_seconds(elapsed)
print '%.2f file removes per second' % (count/in_sec)
print('%.2f file removes per second' % (count/in_sec))

elapsed, result = bench_run( del_dirs, root, dir_count )
in_sec = total_seconds(elapsed)
print '%.2f dir removes per second' % (dir_count/in_sec)
print('%.2f dir removes per second' % (dir_count/in_sec))

if createContainer:
os.rmdir(root)
Expand Down

0 comments on commit 29912db

Please sign in to comment.