+addToPath('../')
+
+from ruby import Ruby
+
+from common import Options
+from common import Simulation
+from common import CacheConfig
+from common import CpuConfig
+from common import MemConfig
+from common.Caches import *
+from common.cpu2000 import *
+
+# Check if KVM support has been enabled, we might need to do VM
+# configuration if that's the case.
+have_kvm_support = 'BaseKvmCPU' in globals()
+def is_kvm_cpu(cpu_class):
+ return have_kvm_support and cpu_class != None and \
+ issubclass(cpu_class, BaseKvmCPU)
+
+def get_processes(options):
+ """Interprets provided options and returns a list of processes"""
+
+ multiprocesses = []
+ inputs = []
+ outputs = []
+ errouts = []
+ pargs = []
+
+ workloads = options.cmd.split(';')
+ if options.input != "":
+ inputs = options.input.split(';')
+ if options.output != "":
+ outputs = options.output.split(';')
+ if options.errout != "":
+ errouts = options.errout.split(';')
+ if options.options != "":
+ pargs = options.options.split(';')
+
+ idx = 0
+ for wrkld in workloads:
+ process = LiveProcess()
+ process.executable = wrkld
+ process.cwd = os.getcwd()
+
+ if options.env:
+ with open(options.env, 'r') as f:
+ process.env = [line.rstrip() for line in f]
+
+ if len(pargs) > idx:
+ process.cmd = [wrkld] + pargs[idx].split()
+ else:
+ process.cmd = [wrkld]
+
+ if len(inputs) > idx:
+ process.input = inputs[idx]
+ if len(outputs) > idx:
+ process.output = outputs[idx]
+ if len(errouts) > idx:
+ process.errout = errouts[idx]
+
+ multiprocesses.append(process)
+ idx += 1
+
+ if options.smt:
+ assert(options.cpu_type == "detailed")
+ return multiprocesses, idx
+ else:
+ return multiprocesses, 1