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

Side by Side Diff: tools/ll_prof.py

Issue 6551011: Fix CPU profiling for Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2010 the V8 project authors. All rights reserved. 3 # Copyright 2010 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 self.header_size = header_size 346 self.header_size = header_size
347 347
348 348
349 class CodeLogReader(object): 349 class CodeLogReader(object):
350 """V8 code event log reader.""" 350 """V8 code event log reader."""
351 351
352 _CODE_INFO_RE = re.compile( 352 _CODE_INFO_RE = re.compile(
353 r"code-info,([^,]+),(\d+)") 353 r"code-info,([^,]+),(\d+)")
354 354
355 _CODE_CREATE_RE = re.compile( 355 _CODE_CREATE_RE = re.compile(
356 r"code-creation,([^,]+),(0x[a-f0-9]+),(\d+),\"(.*)\"(?:,(\d+))?") 356 r"code-creation,([^,]+),(0x[a-f0-9]+),(\d+),\"(.*)\"(?:,(0x[a-f0-9]+),([~*]) ?)?(?:,(\d+))?")
357 357
358 _CODE_MOVE_RE = re.compile( 358 _CODE_MOVE_RE = re.compile(
359 r"code-move,(0x[a-f0-9]+),(0x[a-f0-9]+)") 359 r"code-move,(0x[a-f0-9]+),(0x[a-f0-9]+)")
360 360
361 _CODE_DELETE_RE = re.compile( 361 _CODE_DELETE_RE = re.compile(
362 r"code-delete,(0x[a-f0-9]+)") 362 r"code-delete,(0x[a-f0-9]+)")
363 363
364 _SNAPSHOT_POS_RE = re.compile( 364 _SNAPSHOT_POS_RE = re.compile(
365 r"snapshot-pos,(0x[a-f0-9]+),(\d+)") 365 r"snapshot-pos,(0x[a-f0-9]+),(\d+)")
366 366
(...skipping 26 matching lines...) Expand all
393 return made_progress 393 return made_progress
394 394
395 match = CodeLogReader._CODE_CREATE_RE.match(line) 395 match = CodeLogReader._CODE_CREATE_RE.match(line)
396 if match: 396 if match:
397 start_address = int(match.group(2), 16) + code_header_size 397 start_address = int(match.group(2), 16) + code_header_size
398 end_address = start_address + int(match.group(3)) - code_header_size 398 end_address = start_address + int(match.group(3)) - code_header_size
399 if start_address in self.address_to_snapshot_name: 399 if start_address in self.address_to_snapshot_name:
400 name = self.address_to_snapshot_name[start_address] 400 name = self.address_to_snapshot_name[start_address]
401 origin = JS_SNAPSHOT_ORIGIN 401 origin = JS_SNAPSHOT_ORIGIN
402 else: 402 else:
403 name = "%s:%s" % (match.group(1), match.group(4)) 403 if match.group(6):
Vitaly Repeshko 2011/02/22 15:11:19 Could you please assign these groups (1, 4, 6) to
mnaganov (inactive) 2011/02/22 16:18:22 Done.
404 name = "%s:%s%s" % (match.group(1), match.group(6), match.group(4))
405 else:
406 name = "%s:%s" % (match.group(1), match.group(4))
404 origin = JS_ORIGIN 407 origin = JS_ORIGIN
405 if self.is_snapshot: 408 if self.is_snapshot:
406 origin_offset = 0 409 origin_offset = 0
407 else: 410 else:
408 origin_offset = int(match.group(5)) 411 origin_offset = int(match.group(7))
409 code = Code(name, start_address, end_address, origin, origin_offset) 412 code = Code(name, start_address, end_address, origin, origin_offset)
410 conficting_code = self.code_map.Find(start_address) 413 conficting_code = self.code_map.Find(start_address)
411 if conficting_code: 414 if conficting_code:
412 CodeLogReader._HandleCodeConflict(conficting_code, code) 415 CodeLogReader._HandleCodeConflict(conficting_code, code)
413 # TODO(vitalyr): this warning is too noisy because of our 416 # TODO(vitalyr): this warning is too noisy because of our
414 # attempts to reconstruct code log from the snapshot. 417 # attempts to reconstruct code log from the snapshot.
415 # print >>sys.stderr, \ 418 # print >>sys.stderr, \
416 # "Warning: Skipping duplicate code log entry %s" % code 419 # "Warning: Skipping duplicate code log entry %s" % code
417 continue 420 continue
418 self.code_map.Add(code) 421 self.code_map.Add(code)
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 print "%10d total ticks" % ticks 949 print "%10d total ticks" % ticks
947 print "%10d ticks not in symbols" % missed_ticks 950 print "%10d ticks not in symbols" % missed_ticks
948 print "%10d unaccounted ticks" % really_missed_ticks 951 print "%10d unaccounted ticks" % really_missed_ticks
949 print "%10d total symbols" % len([c for c in code_map.AllCode()]) 952 print "%10d total symbols" % len([c for c in code_map.AllCode()])
950 print "%10d used symbols" % len([c for c in code_map.UsedCode()]) 953 print "%10d used symbols" % len([c for c in code_map.UsedCode()])
951 print "%9.2fs library processing time" % mmap_time 954 print "%9.2fs library processing time" % mmap_time
952 print "%9.2fs tick processing time" % sample_time 955 print "%9.2fs tick processing time" % sample_time
953 956
954 log_reader.Dispose() 957 log_reader.Dispose()
955 trace_reader.Dispose() 958 trace_reader.Dispose()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698