aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-04-27 21:35:45 +0200
committerKarel Kočí <cynerd@email.cz>2015-04-27 21:35:45 +0200
commit4986e12ffffb30aeaad57929fecab69c656ef398 (patch)
tree8d9b504d2cf5a3fbc117a21792979f8c8805d6e5
parent7b575c890182d5b6528b83266d1fd2d1381ddfa6 (diff)
downloadlinux-conf-perf-4986e12ffffb30aeaad57929fecab69c656ef398.tar.gz
linux-conf-perf-4986e12ffffb30aeaad57929fecab69c656ef398.tar.bz2
linux-conf-perf-4986e12ffffb30aeaad57929fecab69c656ef398.zip
Finish implementation of boot.boot
-rw-r--r--scripts/boot.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/scripts/boot.py b/scripts/boot.py
index 50e9f0c..dac17ef 100644
--- a/scripts/boot.py
+++ b/scripts/boot.py
@@ -2,6 +2,7 @@ import os
import sys
import subprocess
import shutil
+import importlib
import utils
from conf import conf
@@ -20,9 +21,32 @@ def gen_nbscript():
f.write('load ' + sf(conf.initram) + '\n')
def boot():
- if not os.path.isfile(conf.nbscript):
+ if not os.path.isfile((conf.nbscript)):
gen_nbscript()
+ try:
+ os.mkdir(sf(conf.output_folder))
+ except FileExistsError:
+ pass
+
+ bench = importlib.machinery.SourceFileLoader("module.name",
+ "../benchmark.py").load_module()
- sprc = subprocess.Popen([conf.novaboot, conf.nbscript] + conf.novaboot_args,
+ sprc = subprocess.Popen([sf(conf.novaboot), sf(conf.nbscript)] + conf.novaboot_args,
stdout = subprocess.PIPE)
+ output = ''
+ for linen in sprc.stdout:
+ line = linen.decode('utf-8')
+ if conf.boot_output:
+ print(line, end="")
+ if line.startswith('lcp-output: '):
+ output += line[12:]
+ print(output)
+ data = bench.stdoutput(output)
+
+ iteration = 0
+ with open(sf(conf.iteration_file), 'a') as f:
+ iteration = int(f.readline())
+ for key, val in data.items():
+ with open(os.path.join(sf(conf.output_folder),key), 'w') as f:
+ f.write(str(iteration) + ':' + str(val) + '\n')