aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-09-14 14:51:31 +0200
committerKarel Kočí <cynerd@email.cz>2015-09-14 14:51:31 +0200
commitb2a1688ba8de9cf255d9d55b78d4b80a3a8ca349 (patch)
tree9301a76b8bf554fc929e0ea65d174c51d1c607dc
parent5d5df1d903e952ada7dbad726431b0cc25e8f5a8 (diff)
downloadlinux-conf-perf-b2a1688ba8de9cf255d9d55b78d4b80a3a8ca349.tar.gz
linux-conf-perf-b2a1688ba8de9cf255d9d55b78d4b80a3a8ca349.tar.bz2
linux-conf-perf-b2a1688ba8de9cf255d9d55b78d4b80a3a8ca349.zip
Fix multithreading
When multithreading was enabled, same configuration could been build multiple times. Adding list of built configurations and filtering list of configurations sourced from database solves this problem. Now script is aware of configurations that was prepared and not yet been measured.
-rwxr-xr-xscripts/loop.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/loop.py b/scripts/loop.py
index f9df231..f7b82bf 100755
--- a/scripts/loop.py
+++ b/scripts/loop.py
@@ -18,18 +18,27 @@ import database
import utils
__confs_unmeasured__ = []
+__confs_prepared__ = []
def prepare():
"""Prepare for measuring
Outcome is Linux image for generated configuration."""
+ def get():
+ confs = dtb.get_unmeasured()
+ for pr in __confs_prepared__:
+ for cn in confs.copy():
+ if pr == cn.hash:
+ confs.remove(cn)
+ break
+ return confs
print("Preparing new image.")
global __confs_unmeasured__
if len(__confs_unmeasured__) == 0:
dtb = database.database()
- confs = dtb.get_unmeasured()
+ confs = get()
if len(confs) == 0:
configurations.generate()
- confs = dtb.get_unmeasured()
+ confs = get()
if len(confs) == 0:
raise exceptions.NoApplicableConfiguration()
__confs_unmeasured__ = list(confs)
@@ -37,6 +46,7 @@ def prepare():
kernel.config(con.config)
img = kernel.make(con.hash)
print("Prepared image: " + img)
+ __confs_prepared__.append(con.hash)
return img, con
def measure(kernelimg, con):
@@ -48,6 +58,7 @@ def measure(kernelimg, con):
os.symlink(kernelimg, sf(conf.jobfolder_linux_image))
boot.boot(con)
print("Configuration '" + con.hash + "' measured.")
+ __confs_prepared__.remove(con.hash)
# Multithread #
__conflist__ = []