OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (C) 2011 Apple Inc. All rights reserved. | 3 # Copyright (C) 2011 Apple Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions | 6 # modification, are permitted provided that the following conditions |
7 # are met: | 7 # are met: |
8 # | 8 # |
9 # 1. Redistributions of source code must retain the above copyright | 9 # 1. Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 else: | 164 else: |
165 scaleSize = options.scaleSize | 165 scaleSize = options.scaleSize |
166 showBars = options.showBars | 166 showBars = options.showBars |
167 | 167 |
168 if len(args) < 1: | 168 if len(args) < 1: |
169 inputFile = sys.stdin | 169 inputFile = sys.stdin |
170 else: | 170 else: |
171 inputFile = open(args[0], "r") | 171 inputFile = open(args[0], "r") |
172 | 172 |
173 line = inputFile.readline() | 173 line = inputFile.readline() |
174 | 174 |
175 rootNodes = {} | 175 rootNodes = {} |
176 | 176 |
177 while line: | 177 while line: |
178 firstSep = line.find('|') | 178 firstSep = line.find('|') |
179 if firstSep > 0: | 179 if firstSep > 0: |
180 firstPart = line[:firstSep].strip() | 180 firstPart = line[:firstSep].strip() |
181 lineRemain = line[firstSep+1:] | 181 lineRemain = line[firstSep+1:] |
182 bytesSep = firstPart.find('bytes:') | 182 bytesSep = firstPart.find('bytes:') |
183 if bytesSep >= 0: | 183 if bytesSep >= 0: |
184 name = firstPart[bytesSep+7:] | 184 name = firstPart[bytesSep+7:] |
(...skipping 10 matching lines...) Expand all Loading... |
195 node.processLine(bytes, lineRemain) | 195 node.processLine(bytes, lineRemain) |
196 | 196 |
197 line = inputFile.readline() | 197 line = inputFile.readline() |
198 | 198 |
199 sortedRootNodes = sorted(rootNodes.values(), key=sortKeyByBytes, reverse=Tru
e) | 199 sortedRootNodes = sorted(rootNodes.values(), key=sortKeyByBytes, reverse=Tru
e) |
200 | 200 |
201 print 'Call graph:' | 201 print 'Call graph:' |
202 try: | 202 try: |
203 for node in sortedRootNodes: | 203 for node in sortedRootNodes: |
204 node.printNode() | 204 node.printNode() |
205 print | 205 print |
206 except: | 206 except: |
207 pass | 207 pass |
208 | 208 |
209 if __name__ == "__main__": | 209 if __name__ == "__main__": |
210 main() | 210 main() |
OLD | NEW |