PLAT-130888: Added counter no-server/json_dump option.
Change-Id: I22fc2477845982beef8934d2fb55b519d2b2960c
This commit is contained in:
gecommit door
Giovanni Baraldi
bovenliggende
f656ef0784
commit
317147ca11
@@ -232,7 +232,7 @@ while [ 1 ] ; do
|
||||
ATT_ARGV="$ATT_ARGV $3 \"$4\""
|
||||
shift
|
||||
shift
|
||||
elif [[ "$3" = "--ports" || "$3" = "--genasm" || "$3" = "--target_cu" || "$3" = "-o" || "$3" == "-k" || "$3" == "--att_kernel" ]]; then
|
||||
elif [[ "$3" = "--dumpfiles" || "$3" = "--ports" || "$3" = "--genasm" || "$3" == "--att_kernel" ]]; then
|
||||
ATT_ARGV="$ATT_ARGV $3 $4"
|
||||
shift
|
||||
shift
|
||||
|
||||
@@ -434,11 +434,13 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("assembly_code", help="Path of the assembly code")
|
||||
parser.add_argument("--trace_file", help="Filter for trace files", default=None, type=str)
|
||||
parser.add_argument("-k", "--att_kernel", help="Kernel file", type=str, default=pathenv+'/*_kernel.txt')
|
||||
parser.add_argument("-p", "--ports", help="Server and websocket ports, default: 8000,18000")
|
||||
parser.add_argument("--target_cu", help="Collected target CU id{0-15}", type=int, default=None)
|
||||
parser.add_argument("-g", "--genasm",
|
||||
parser.add_argument("--att_kernel", help="Kernel file",
|
||||
type=str, default=pathenv+'/*_kernel.txt')
|
||||
parser.add_argument("--ports", help="Server and websocket ports, default: 8000,18000")
|
||||
parser.add_argument("--genasm",
|
||||
help="Generate post-processed asm file at this path", type=str, default="")
|
||||
parser.add_argument("--dumpfiles", help="Dont open server, \
|
||||
dump json files to disk instead.", default=False, action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
global EVENT_NAMES
|
||||
@@ -450,7 +452,7 @@ if __name__ == "__main__":
|
||||
for line in lines:
|
||||
if 'PERFCOUNTER_ID=' in line:
|
||||
EVENT_NAMES += ['id: '+clean(line)]
|
||||
elif args.target_cu is None and 'att: TARGET_CU' in line:
|
||||
elif 'att: TARGET_CU' in line:
|
||||
args.target_cu = int(clean(line))
|
||||
print('Target CU set to:', args.target_cu)
|
||||
for line in lines:
|
||||
@@ -537,7 +539,7 @@ if __name__ == "__main__":
|
||||
time_acc += state[1]
|
||||
|
||||
if args.genasm and len(args.genasm) > 0:
|
||||
flight_count = view_trace(args, 0, code, jumps, DBFILES, analysed_filenames, True, None, OCCUPANCY)
|
||||
flight_count = view_trace(args, code, jumps, DBFILES, analysed_filenames, True, None, OCCUPANCY, args.dumpfiles)
|
||||
|
||||
with open(args.assembly_code, 'r') as file:
|
||||
lines = file.readlines()
|
||||
@@ -549,4 +551,4 @@ if __name__ == "__main__":
|
||||
for k in keys:
|
||||
file.write(assembly_code[k]+'\n')
|
||||
else:
|
||||
view_trace(args, 0, code, jumps, DBFILES, analysed_filenames, False, GeneratePIC, OCCUPANCY)
|
||||
view_trace(args, code, jumps, DBFILES, analysed_filenames, False, GeneratePIC, OCCUPANCY, args.dumpfiles)
|
||||
|
||||
@@ -627,7 +627,7 @@ def call_picture_callback(return_dict):
|
||||
for n, e in enumerate(counter_events):
|
||||
return_dict['se'+str(n)+'_perfcounter.json'] = Readable({"data": [v.toTuple() for v in e]})
|
||||
|
||||
def view_trace(args, wait, code, jumps, dbnames, att_filenames, bReturnLoc, pic_callback, OCCUPANCY):
|
||||
def view_trace(args, code, jumps, dbnames, att_filenames, bReturnLoc, pic_callback, OCCUPANCY, bDumpOnly):
|
||||
global PICTURE_CALLBACK
|
||||
PICTURE_CALLBACK = pic_callback
|
||||
manager = Manager()
|
||||
@@ -677,21 +677,29 @@ def view_trace(args, wait, code, jumps, dbnames, att_filenames, bReturnLoc, pic_
|
||||
|
||||
JSON_GLOBAL_DICTIONARY['filenames.json'] = Readable({"filenames": simd_wave_filenames})
|
||||
|
||||
if args.ports:
|
||||
assign_ports(args.ports)
|
||||
print('serving at ports: {0},{1}'.format(PORT, WebSocketPort))
|
||||
if pic_thread is not None:
|
||||
pic_thread.join()
|
||||
for k, v in return_dict.items():
|
||||
JSON_GLOBAL_DICTIONARY[k] = v
|
||||
|
||||
if wait == 0:
|
||||
if bDumpOnly == False:
|
||||
if args.ports:
|
||||
assign_ports(args.ports)
|
||||
print('serving at ports: {0},{1}'.format(PORT, WebSocketPort))
|
||||
try:
|
||||
PROCS = [Process(target=run_server), Process(target=run_websocket)]
|
||||
if pic_thread is not None:
|
||||
pic_thread.join()
|
||||
for k, v in return_dict.items():
|
||||
JSON_GLOBAL_DICTIONARY[k] = v
|
||||
|
||||
for p in PROCS:
|
||||
p.start()
|
||||
for p in PROCS:
|
||||
p.join()
|
||||
except KeyboardInterrupt:
|
||||
print("Exitting.")
|
||||
else:
|
||||
os.makedirs('ui', exist_ok=True)
|
||||
for k, v in JSON_GLOBAL_DICTIONARY.items():
|
||||
if '.json' in k:
|
||||
try:
|
||||
with open(os.path.join('ui',k), 'w') as f:
|
||||
f.write(v.read())
|
||||
except:
|
||||
pass
|
||||
|
||||
Verwijs in nieuw issue
Block a user