decode_packet_trace.py (12211:149c9225b7d6) | decode_packet_trace.py (12212:1ae8dc8fdb97) |
---|---|
1#!/usr/bin/env python2 2 3# Copyright (c) 2013-2014 ARM Limited 4# All rights reserved 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 38 unchanged lines hidden (view full) --- 47# addr, size, tick,flags. For example: 48# r,128,64,4000,0 49# w,232123,64,500000,0 50 51import protolib 52import sys 53 54# Import the packet proto definitions. If they are not found, attempt | 1#!/usr/bin/env python2 2 3# Copyright (c) 2013-2014 ARM Limited 4# All rights reserved 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 38 unchanged lines hidden (view full) --- 47# addr, size, tick,flags. For example: 48# r,128,64,4000,0 49# w,232123,64,500000,0 50 51import protolib 52import sys 53 54# Import the packet proto definitions. If they are not found, attempt |
55# to generate them automatically. This assumes that the script is 56# executed from the gem5 root. | 55# to generate them automatically. |
57try: 58 import packet_pb2 59except: 60 print "Did not find packet proto definitions, attempting to generate" | 56try: 57 import packet_pb2 58except: 59 print "Did not find packet proto definitions, attempting to generate" |
60 import os 61 util_dir = os.path.dirname(os.path.realpath(__file__)) 62 proto_dir = os.path.join(os.path.dirname(util_dir), 'src', 'proto') 63 proto_file = os.path.join(proto_dir, 'packet.proto') |
|
61 from subprocess import call | 64 from subprocess import call |
62 error = call(['protoc', '--python_out=util', '--proto_path=src/proto', 63 'src/proto/packet.proto']) | 65 error = call(['protoc', '--python_out=' + util_dir, 66 '--proto_path=' + proto_dir, proto_file]) |
64 if not error: 65 print "Generated packet proto definitions" 66 67 try: 68 import google.protobuf 69 except: 70 print "Please install Python protobuf module" 71 exit(-1) --- 70 unchanged lines hidden --- | 67 if not error: 68 print "Generated packet proto definitions" 69 70 try: 71 import google.protobuf 72 except: 73 print "Please install Python protobuf module" 74 exit(-1) --- 70 unchanged lines hidden --- |