def getBenchmark(benchmark): section, name = benchmark.split(".") if section == "local": import benchmarks_local return benchmarks_local.getBenchmark(name); elif section == "remote": import benchmarks_remote return benchmarks_remote.getBenchmark(name); elif section == "shell": import benchmarks_shell return benchmarks_shell.getBenchmark(name); else: raise Exception("Unknown benchmark type")
def parseBenchmarks(li): benchmarks = [] for benchmark in li.split(","): benchmark = benchmark.strip() _, section, name = benchmark.split(".") if section == "local": import benchmarks_local benchmarks.append(benchmarks_local.getBenchmark(name)) elif section == "remote": import benchmarks_remote benchmarks.append(benchmarks_remote.getBenchmark(name)) elif section == "shell": import benchmarks_shell benchmarks.append(benchmarks_shell.getBenchmark(name)) else: raise Exception("Unknown benchmark type") return benchmarks