Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tools/cygprofile/patch_orderfile.py

Issue 859873002: Fix the prefix removal in patch_orderfile.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import commands 6 import commands
7 import os 7 import os
8 import sys 8 import sys
9 9
10 orderfile = sys.argv[1] 10 orderfile = sys.argv[1]
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 elif (addr < nm_addr): 56 elif (addr < nm_addr):
57 return binary_search (addr, start, halfway) 57 return binary_search (addr, start, halfway)
58 elif (addr >= nm_addr + sym_size): 58 elif (addr >= nm_addr + sym_size):
59 return binary_search (addr, halfway, end) 59 return binary_search (addr, halfway, end)
60 else: 60 else:
61 raise Exception("ERROR: did not expect this case") 61 raise Exception("ERROR: did not expect this case")
62 62
63 f = open (orderfile) 63 f = open (orderfile)
64 lines = f.readlines() 64 lines = f.readlines()
65 profiled_list = [] 65 profiled_list = []
66 prefixes = ['.text.', '.text.startup.', '.text.hot.', '.text.unlikely.'] 66 prefixes = ['.text.startup.', '.text.hot.', '.text.unlikely.', '.text.']
67 for line in lines: 67 for line in lines:
68 for prefix in prefixes: 68 for prefix in prefixes:
69 line = line.replace(prefix, '') 69 line = line.replace(prefix, '')
70 functionName = line.split('.clone.')[0].strip() 70 functionName = line.split('.clone.')[0].strip()
71 if (functionName == ''): 71 if (functionName == ''):
72 continue 72 continue
73 profiled_list.append(functionName) 73 profiled_list.append(functionName)
74 74
75 # Symbol names are not unique. Since the order file uses symbol names, the 75 # Symbol names are not unique. Since the order file uses symbol names, the
76 # patched order file pulls in all symbols with the same name. Multiple function 76 # patched order file pulls in all symbols with the same name. Multiple function
(...skipping 16 matching lines...) Expand all
93 93
94 sys.stderr.write ("profiled list size: " + str(len(profiled_list)) + "\n") 94 sys.stderr.write ("profiled list size: " + str(len(profiled_list)) + "\n")
95 addresses = [] 95 addresses = []
96 symbols_found = 0 96 symbols_found = 0
97 for function in profiled_list: 97 for function in profiled_list:
98 try: 98 try:
99 addrs = functionAddressMap[function] 99 addrs = functionAddressMap[function]
100 symbols_found = symbols_found + 1 100 symbols_found = symbols_found + 1
101 except Exception: 101 except Exception:
102 addrs = [] 102 addrs = []
103 # sys.stderr.write ("WARNING: could not find symbol " + function + "\n") 103 sys.stderr.write ("WARNING: could not find symbol " + function + "\n")
azarchs 2015/01/19 18:13:21 From my local run I'd expect roughly 140k warnings
104 for addr in addrs: 104 for addr in addrs:
105 if not (addr in addresses): 105 if not (addr in addresses):
106 addresses.append(addr) 106 addresses.append(addr)
107 sys.stderr.write ("symbols found: " + str(symbols_found) + "\n") 107 sys.stderr.write ("symbols found: " + str(symbols_found) + "\n")
108 108
109 sys.stderr.write ("number of addresses: " + str(len(addresses)) + "\n") 109 sys.stderr.write ("number of addresses: " + str(len(addresses)) + "\n")
110 total_size = 0 110 total_size = 0
111 for addr in addresses: 111 for addr in addresses:
112 (functions, size) = binary_search (addr, 0, len(uniqueAddrs)) 112 (functions, size) = binary_search (addr, 0, len(uniqueAddrs))
113 total_size = total_size + size 113 total_size = total_size + size
114 for function in functions: 114 for function in functions:
115 for prefix in prefixes: 115 for prefix in prefixes:
116 print prefix + function 116 print prefix + function
117 117
118 # The following is needed otherwise Gold only applies a partial sort. 118 # The following is needed otherwise Gold only applies a partial sort.
119 print '.text' # gets methods not in a section, such as assembly 119 print '.text' # gets methods not in a section, such as assembly
120 print '.text.*' # gets everything else 120 print '.text.*' # gets everything else
121 sys.stderr.write ("total_size: " + str(total_size) + "\n") 121 sys.stderr.write ("total_size: " + str(total_size) + "\n")
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698