Skip to content

Commit

Permalink
ArmPlatformPkg/Scripts: Update the profiling script to work on AArch6…
Browse files Browse the repository at this point in the history
…4 with the latest DS-5

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15836 6f19259b-4bc3-4df7-8a09-765794883524
  • Loading branch information
oliviermartin authored and oliviermartin committed Aug 19, 2014
1 parent 04ad241 commit 743a2a5
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ArmPlatformPkg/Scripts/Ds5/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def usage():
print "-t,--trace: Location of the Trace file"
print "-s,--symbols: Location of the symbols and modules"

def get_address_from_string(address):
return int(address.strip("S:").strip("N:").strip("EL2:").strip("EL1:"), 16)

def get_module_from_addr(modules, addr):
for key,value in modules.items():
if (value['start'] <= addr) and (addr <= value['end']):
Expand Down Expand Up @@ -174,8 +177,13 @@ def trace_read():
line = info_file_str.readline().strip('\n')
while (line != '') and ("Symbols from" not in line):
if ("ER_RO" in line):
modules[module_name]['start'] = int(line.split()[0].strip("S:"), 16)
modules[module_name]['end'] = int(line.split()[2].strip("S:"), 16)
modules[module_name]['start'] = get_address_from_string(line.split()[0])
modules[module_name]['end'] = get_address_from_string(line.split()[2])
line = info_file_str.readline().strip('\n')
break;
if (".text" in line):
modules[module_name]['start'] = get_address_from_string(line.split()[0])
modules[module_name]['end'] = get_address_from_string(line.split()[2])
line = info_file_str.readline().strip('\n')
break;
line = info_file_str.readline().strip('\n')
Expand All @@ -191,6 +199,14 @@ def trace_read():
line = info_func_str.readline().strip('\n')
func_prev = None
while line != '':
# We ignore all the functions after 'Functions in'
if ("Functions in " in line):
line = info_func_str.readline().strip('\n')
while line != '':
line = info_func_str.readline().strip('\n')
line = info_func_str.readline().strip('\n')
continue

if ("Low-level symbols" in line):
# We need to fixup the last function of the module
if func_prev is not None:
Expand All @@ -199,9 +215,11 @@ def trace_read():

line = info_func_str.readline().strip('\n')
continue

func_name = line.split()[1]
func_start = int(line.split()[0].strip("S:"), 16)
func_start = get_address_from_string(line.split()[0])
module_name = get_module_from_addr(modules, func_start)

if func_name not in functions.keys():
functions[func_name] = {}
functions[func_name][module_name] = {}
Expand Down Expand Up @@ -263,7 +281,7 @@ def trace_read():
while line:
try:
func_name = line.split('\t')[column_function].strip()
address = int(line.split('\t')[column_addr].strip("S:"), 16)
address = get_address_from_string(line.split('\t')[column_addr])
cycles = int(line.split('\t')[column_cycles])
callee = add_cycles_to_function(functions, func_name, address, cycles)
if (prev_callee != None) and (prev_callee != callee):
Expand Down

0 comments on commit 743a2a5

Please sign in to comment.