def runConfig(comp, cmin, cmax, cavg, data):
# make sure there is no leftover repository. This will throw a warning on the shell if there is no folder, but it can be ignored
subprocess.call(["rm", "-r", "/tmp/borgbench/"+comp])
# run borg
subprocess.call(["borg", "init", "-e", "none", "/tmp/borgbench/"+comp])
start = timer()
proc=subprocess.Popen(["borg", "create", "/tmp/borgbench/"+comp+"::test", "-v", "-s", "-C", comp, data], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = proc.stderr.read()
duration = timer() - start
# parse output
m = re.match(".*This archive: +(\d+\.?\d+ ..) +(\d+\.?\d+ ..) +(\d+\.?\d+ ..).*Chunk index: +(\d+) +(\d+)", str(output))
if m:
print(comp+";"+str(cmin)+";"+str(cmax)+";"+str(cavg)+";"+m.group(1)+";"+m.group(2)+";"+m.group(3)+";"+m.group(4)+";"+m.group(5)+";"+str(duration))
else:
print("Error")
# and clean up
subprocess.call(["rm", "-r", "/tmp/borgbench/"+comp])
# Benchmark calls
# For speed reasons, this should be a tmpfs
评论列表
文章目录