summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Scripts
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-08-19 13:36:00 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-19 13:36:00 +0000
commit743a2a550c9e77419968500216c9383296910ebf (patch)
tree9a7c478cde0862fcc034bc907640ef37d3c28632 /ArmPlatformPkg/Scripts
parent04ad241e2081312be62a9f299311949e85ed725c (diff)
downloadedk2-743a2a550c9e77419968500216c9383296910ebf.tar.gz
edk2-743a2a550c9e77419968500216c9383296910ebf.tar.bz2
edk2-743a2a550c9e77419968500216c9383296910ebf.zip
ArmPlatformPkg/Scripts: Update the profiling script to work on AArch64 with the latest DS-5
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15836 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Scripts')
-rw-r--r--ArmPlatformPkg/Scripts/Ds5/profile.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/ArmPlatformPkg/Scripts/Ds5/profile.py b/ArmPlatformPkg/Scripts/Ds5/profile.py
index c595dac717..2e55993c60 100644
--- a/ArmPlatformPkg/Scripts/Ds5/profile.py
+++ b/ArmPlatformPkg/Scripts/Ds5/profile.py
@@ -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']):
@@ -174,8 +177,13 @@ try:
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')
@@ -191,6 +199,14 @@ try:
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:
@@ -199,9 +215,11 @@ try:
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] = {}
@@ -263,7 +281,7 @@ prev_callee = None
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):