lat_mem_rd.py (12550:e33f0bfa3eda) | lat_mem_rd.py (12564:2778478ca882) |
---|---|
1# Copyright (c) 2015-2016 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 21 unchanged lines hidden (view full) --- 30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35# 36# Authors: Andreas Hansson 37 | 1# Copyright (c) 2015-2016 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 21 unchanged lines hidden (view full) --- 30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35# 36# Authors: Andreas Hansson 37 |
38from __future__ import print_function 39 |
|
38import gzip 39import optparse 40import os 41 42import m5 43from m5.objects import * 44from m5.util import addToPath 45from m5.stats import periodicStatDump --- 9 unchanged lines hidden (view full) --- 55# configurations, in essence replicating the lmbench lat_mem_rd thrash 56# behaviour 57 58# import the packet proto definitions, and if they are not found, 59# attempt to generate them automatically 60try: 61 import packet_pb2 62except: | 40import gzip 41import optparse 42import os 43 44import m5 45from m5.objects import * 46from m5.util import addToPath 47from m5.stats import periodicStatDump --- 9 unchanged lines hidden (view full) --- 57# configurations, in essence replicating the lmbench lat_mem_rd thrash 58# behaviour 59 60# import the packet proto definitions, and if they are not found, 61# attempt to generate them automatically 62try: 63 import packet_pb2 64except: |
63 print "Did not find packet proto definitions, attempting to generate" | 65 print("Did not find packet proto definitions, attempting to generate") |
64 from subprocess import call 65 error = call(['protoc', '--python_out=configs/dram', 66 '--proto_path=src/proto', 'src/proto/packet.proto']) 67 if not error: | 66 from subprocess import call 67 error = call(['protoc', '--python_out=configs/dram', 68 '--proto_path=src/proto', 'src/proto/packet.proto']) 69 if not error: |
68 print "Generated packet proto definitions" | 70 print("Generated packet proto definitions") |
69 70 try: 71 import google.protobuf 72 except: | 71 72 try: 73 import google.protobuf 74 except: |
73 print "Please install the Python protobuf module" | 75 print("Please install the Python protobuf module") |
74 exit(-1) 75 76 import packet_pb2 77 else: | 76 exit(-1) 77 78 import packet_pb2 79 else: |
78 print "Failed to import packet proto definitions" | 80 print("Failed to import packet proto definitions") |
79 exit(-1) 80 81parser = optparse.OptionParser() 82 83parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8", 84 choices=MemConfig.mem_names(), 85 help = "type of memory to use") 86parser.add_option("--mem-size", action="store", type="string", 87 default="16MB", 88 help="Specify the memory size") 89parser.add_option("--reuse-trace", action="store_true", 90 help="Prevent generation of traces and reuse existing") 91 92(options, args) = parser.parse_args() 93 94if args: | 81 exit(-1) 82 83parser = optparse.OptionParser() 84 85parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8", 86 choices=MemConfig.mem_names(), 87 help = "type of memory to use") 88parser.add_option("--mem-size", action="store", type="string", 89 default="16MB", 90 help="Specify the memory size") 91parser.add_option("--reuse-trace", action="store_true", 92 help="Prevent generation of traces and reuse existing") 93 94(options, args) = parser.parse_args() 95 96if args: |
95 print "Error: script doesn't take any positional arguments" | 97 print("Error: script doesn't take any positional arguments") |
96 sys.exit(1) 97 98# start by creating the system itself, using a multi-layer 2.0 GHz 99# crossbar, delivering 64 bytes / 3 cycles (one header cycle) which 100# amounts to 42.7 GByte/s per layer and thus per port 101system = System(membus = SystemXBar(width = 32)) 102system.clk_domain = SrcClockDomain(clock = '2.0GHz', 103 voltage_domain = --- 62 unchanged lines hidden (view full) --- 166 167# for every data point, we create a trace containing a random address 168# sequence, so that we can play back the same sequence for warming and 169# the actual measurement 170def create_trace(filename, max_addr, burst_size, itt): 171 try: 172 proto_out = gzip.open(filename, 'wb') 173 except IOError: | 98 sys.exit(1) 99 100# start by creating the system itself, using a multi-layer 2.0 GHz 101# crossbar, delivering 64 bytes / 3 cycles (one header cycle) which 102# amounts to 42.7 GByte/s per layer and thus per port 103system = System(membus = SystemXBar(width = 32)) 104system.clk_domain = SrcClockDomain(clock = '2.0GHz', 105 voltage_domain = --- 62 unchanged lines hidden (view full) --- 168 169# for every data point, we create a trace containing a random address 170# sequence, so that we can play back the same sequence for warming and 171# the actual measurement 172def create_trace(filename, max_addr, burst_size, itt): 173 try: 174 proto_out = gzip.open(filename, 'wb') 175 except IOError: |
174 print "Failed to open ", filename, " for writing" | 176 print("Failed to open ", filename, " for writing") |
175 exit(-1) 176 177 # write the magic number in 4-byte Little Endian, similar to what 178 # is done in src/proto/protoio.cc 179 proto_out.write("gem5") 180 181 # add the packet header 182 header = packet_pb2.PacketHeader() --- 20 unchanged lines hidden (view full) --- 203 packet.tick = long(tick) 204 packet.addr = long(addr) 205 protolib.encodeMessage(proto_out, packet) 206 tick = tick + itt 207 208 proto_out.close() 209 210# this will take a while, so keep the user informed | 177 exit(-1) 178 179 # write the magic number in 4-byte Little Endian, similar to what 180 # is done in src/proto/protoio.cc 181 proto_out.write("gem5") 182 183 # add the packet header 184 header = packet_pb2.PacketHeader() --- 20 unchanged lines hidden (view full) --- 205 packet.tick = long(tick) 206 packet.addr = long(addr) 207 protolib.encodeMessage(proto_out, packet) 208 tick = tick + itt 209 210 proto_out.close() 211 212# this will take a while, so keep the user informed |
211print "Generating traces, please wait..." | 213print("Generating traces, please wait...") |
212 213nxt_range = 0 214nxt_state = 0 215period = long(itt * (max_range / burst_size)) 216 217# now we create the states for each range 218for r in ranges: 219 filename = os.path.join(m5.options.outdir, --- 79 unchanged lines hidden (view full) --- 299# run Forrest, run! 300root = Root(full_system = False, system = system) 301root.system.mem_mode = 'timing' 302 303m5.instantiate() 304m5.simulate(nxt_state * period) 305 306# print all we need to make sense of the stats output | 214 215nxt_range = 0 216nxt_state = 0 217period = long(itt * (max_range / burst_size)) 218 219# now we create the states for each range 220for r in ranges: 221 filename = os.path.join(m5.options.outdir, --- 79 unchanged lines hidden (view full) --- 301# run Forrest, run! 302root = Root(full_system = False, system = system) 303root.system.mem_mode = 'timing' 304 305m5.instantiate() 306m5.simulate(nxt_state * period) 307 308# print all we need to make sense of the stats output |
307print "lat_mem_rd with %d iterations, ranges:" % iterations | 309print("lat_mem_rd with %d iterations, ranges:" % iterations) |
308for r in ranges: | 310for r in ranges: |
309 print r | 311 print(r) |