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

Side by Side Diff: tools/tickprocessor.py

Issue 24022: Add ticks to the profiler output. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
« 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 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 self.PrintEntries(cpp_entries, lambda e:e.IsSharedLibraryEntry()) 272 self.PrintEntries(cpp_entries, lambda e:e.IsSharedLibraryEntry())
273 # Print the JavaScript ticks. 273 # Print the JavaScript ticks.
274 self.PrintHeader('JavaScript') 274 self.PrintHeader('JavaScript')
275 self.PrintEntries(js_entries, lambda e:not e.IsSharedLibraryEntry()) 275 self.PrintEntries(js_entries, lambda e:not e.IsSharedLibraryEntry())
276 # Print the C++ ticks. 276 # Print the C++ ticks.
277 self.PrintHeader('C++') 277 self.PrintHeader('C++')
278 self.PrintEntries(cpp_entries, lambda e:not e.IsSharedLibraryEntry()) 278 self.PrintEntries(cpp_entries, lambda e:not e.IsSharedLibraryEntry())
279 279
280 def PrintHeader(self, header_title): 280 def PrintHeader(self, header_title):
281 print('\n [%s]:' % header_title) 281 print('\n [%s]:' % header_title)
282 print(' total nonlib name') 282 print(' ticks total nonlib name')
283 283
284 def PrintEntries(self, entries, condition): 284 def PrintEntries(self, entries, condition):
285 number_of_accounted_ticks = self.total_number_of_ticks - self.unaccounted_nu mber_of_ticks 285 number_of_accounted_ticks = self.total_number_of_ticks - self.unaccounted_nu mber_of_ticks
286 number_of_non_library_ticks = number_of_accounted_ticks - self.number_of_lib rary_ticks 286 number_of_non_library_ticks = number_of_accounted_ticks - self.number_of_lib rary_ticks
287 entries.sort(key=lambda e:e.tick_count, reverse=True) 287 entries.sort(key=lambda e:e.tick_count, reverse=True)
288 for entry in entries: 288 for entry in entries:
289 if entry.tick_count > 0 and condition(entry): 289 if entry.tick_count > 0 and condition(entry):
290 total_percentage = entry.tick_count * 100.0 / number_of_accounted_ticks 290 total_percentage = entry.tick_count * 100.0 / number_of_accounted_ticks
291 if entry.IsSharedLibraryEntry(): 291 if entry.IsSharedLibraryEntry():
292 non_library_percentage = 0 292 non_library_percentage = 0
293 else: 293 else:
294 non_library_percentage = entry.tick_count * 100.0 / number_of_non_libr ary_ticks 294 non_library_percentage = entry.tick_count * 100.0 / number_of_non_libr ary_ticks
295 print(' %(total)5.1f%% %(nonlib)6.1f%% %(name)s' % { 295 print(' %(ticks)5d %(total)5.1f%% %(nonlib)6.1f%% %(name)s' % {
296 'ticks' : entry.tick_count,
296 'total' : total_percentage, 297 'total' : total_percentage,
297 'nonlib' : non_library_percentage, 298 'nonlib' : non_library_percentage,
298 'name' : entry.ToString() 299 'name' : entry.ToString()
299 }) 300 })
300 region_ticks = entry.RegionTicks() 301 region_ticks = entry.RegionTicks()
301 if not region_ticks is None: 302 if not region_ticks is None:
302 items = region_ticks.items() 303 items = region_ticks.items()
303 items.sort(key=lambda e: e[1][1], reverse=True) 304 items.sort(key=lambda e: e[1][1], reverse=True)
304 for (name, ticks) in items: 305 for (name, ticks) in items:
305 print(' flat cum') 306 print(' flat cum')
306 print(' %(flat)5.1f%% %(accum)5.1f%% %(name)s' % { 307 print(' %(flat)5.1f%% %(accum)5.1f%% %(name)s' % {
307 'flat' : ticks[1] * 100.0 / entry.tick_count, 308 'flat' : ticks[1] * 100.0 / entry.tick_count,
308 'accum' : ticks[0] * 100.0 / entry.tick_count, 309 'accum' : ticks[0] * 100.0 / entry.tick_count,
309 'name': name 310 'name': name
310 }) 311 })
311 312
312 if __name__ == '__main__': 313 if __name__ == '__main__':
313 sys.exit('You probably want to run windows-tick-processor.py or linux-tick-pro cessor.py.') 314 sys.exit('You probably want to run windows-tick-processor.py or linux-tick-pro cessor.py.')
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