Revision: 15836
          http://sourceforge.net/p/edk2/code/15836
Author:   oliviermartin
Date:     2014-08-19 13:36:00 +0000 (Tue, 19 Aug 2014)
Log Message:
-----------
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 <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/Scripts/Ds5/profile.py

Modified: trunk/edk2/ArmPlatformPkg/Scripts/Ds5/profile.py
===================================================================
--- trunk/edk2/ArmPlatformPkg/Scripts/Ds5/profile.py    2014-08-19 13:35:14 UTC 
(rev 15835)
+++ trunk/edk2/ArmPlatformPkg/Scripts/Ds5/profile.py    2014-08-19 13:36:00 UTC 
(rev 15836)
@@ -28,6 +28,9 @@
        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,10 +177,15 @@
                        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')
                line = info_file_str.readline().strip('\n')
 
@@ -191,6 +199,14 @@
        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 @@
 
                        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 @@
 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):

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to