se.py (5457:08bd3709d482) | se.py (5514:9a903bf83a33) |
---|---|
1# Copyright (c) 2006-2008 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 23 unchanged lines hidden (view full) --- 32 33import m5 34 35if m5.build_env['FULL_SYSTEM']: 36 m5.panic("This script requires syscall emulation mode (*_SE).") 37 38from m5.objects import * 39import os, optparse, sys | 1# Copyright (c) 2006-2008 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 23 unchanged lines hidden (view full) --- 32 33import m5 34 35if m5.build_env['FULL_SYSTEM']: 36 m5.panic("This script requires syscall emulation mode (*_SE).") 37 38from m5.objects import * 39import os, optparse, sys |
40from os.path import join as joinpath |
|
40m5.AddToPath('../common') 41import Simulation 42from Caches import * 43from cpu2000 import * 44 45# Get paths we might need. It's expected this file is in m5/configs/example. 46config_path = os.path.dirname(os.path.abspath(__file__)) 47config_root = os.path.dirname(config_path) 48m5_root = os.path.dirname(config_root) 49 50parser = optparse.OptionParser() 51 52# Benchmark options 53parser.add_option("-c", "--cmd", | 41m5.AddToPath('../common') 42import Simulation 43from Caches import * 44from cpu2000 import * 45 46# Get paths we might need. It's expected this file is in m5/configs/example. 47config_path = os.path.dirname(os.path.abspath(__file__)) 48config_root = os.path.dirname(config_path) 49m5_root = os.path.dirname(config_root) 50 51parser = optparse.OptionParser() 52 53# Benchmark options 54parser.add_option("-c", "--cmd", |
54 default=os.path.join(m5_root, "tests/test-progs/hello/bin/alpha/linux/hello"), 55 help="The binary to run in syscall emulation mode.") | 55 default=joinpath(m5_root, "tests/test-progs/hello/bin/alpha/linux/hello"), 56 help="The binary to run in syscall emulation mode.") |
56parser.add_option("-o", "--options", default="", | 57parser.add_option("-o", "--options", default="", |
57 help="The options to pass to the binary, use \" \" around the entire\ 58 string.") 59parser.add_option("-i", "--input", default="", 60 help="A file of input to give to the binary.") | 58 help='The options to pass to the binary, use " " around the entire string') 59parser.add_option("-i", "--input", default="", help="Read stdin from a file.") 60parser.add_option("--output", default="", help="Redirect stdout to a file.") 61parser.add_option("--errout", default="", help="Redirect stderr to a file.") |
61 62execfile(os.path.join(config_root, "common", "Options.py")) 63 64(options, args) = parser.parse_args() 65 66if args: 67 print "Error: script doesn't take any positional arguments" 68 sys.exit(1) --- 11 unchanged lines hidden (view full) --- 80else: 81 process = LiveProcess() 82 process.executable = options.cmd 83 process.cmd = [options.cmd] + options.options.split() 84 85 86if options.input != "": 87 process.input = options.input | 62 63execfile(os.path.join(config_root, "common", "Options.py")) 64 65(options, args) = parser.parse_args() 66 67if args: 68 print "Error: script doesn't take any positional arguments" 69 sys.exit(1) --- 11 unchanged lines hidden (view full) --- 81else: 82 process = LiveProcess() 83 process.executable = options.cmd 84 process.cmd = [options.cmd] + options.options.split() 85 86 87if options.input != "": 88 process.input = options.input |
89if options.output != "": 90 process.output = options.output 91if options.errout != "": 92 process.errout = options.errout |
|
88 89if options.detailed: 90 #check for SMT workload 91 workloads = options.cmd.split(';') 92 if len(workloads) > 1: 93 process = [] 94 smt_idx = 0 95 inputs = [] | 93 94if options.detailed: 95 #check for SMT workload 96 workloads = options.cmd.split(';') 97 if len(workloads) > 1: 98 process = [] 99 smt_idx = 0 100 inputs = [] |
101 outputs = [] 102 errouts = [] |
|
96 97 if options.input != "": 98 inputs = options.input.split(';') | 103 104 if options.input != "": 105 inputs = options.input.split(';') |
106 if options.output != "": 107 outputs = options.output.split(';') 108 if options.errout != "": 109 errouts = options.errout.split(';') |
|
99 100 for wrkld in workloads: 101 smt_process = LiveProcess() 102 smt_process.executable = wrkld 103 smt_process.cmd = wrkld + " " + options.options 104 if inputs and inputs[smt_idx]: 105 smt_process.input = inputs[smt_idx] | 110 111 for wrkld in workloads: 112 smt_process = LiveProcess() 113 smt_process.executable = wrkld 114 smt_process.cmd = wrkld + " " + options.options 115 if inputs and inputs[smt_idx]: 116 smt_process.input = inputs[smt_idx] |
117 if outputs and outputs[smt_idx]: 118 smt_process.output = outputs[smt_idx] 119 if errouts and errouts[smt_idx]: 120 smt_process.errout = errouts[smt_idx] |
|
106 process += [smt_process, ] 107 smt_idx += 1 108 109(CPUClass, test_mem_mode, FutureClass) = Simulation.setCPUClass(options) 110 111CPUClass.clock = '2GHz' 112 113np = options.num_cpus --- 29 unchanged lines hidden --- | 121 process += [smt_process, ] 122 smt_idx += 1 123 124(CPUClass, test_mem_mode, FutureClass) = Simulation.setCPUClass(options) 125 126CPUClass.clock = '2GHz' 127 128np = options.num_cpus --- 29 unchanged lines hidden --- |