OLD | NEW |
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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 if (bit & sample_type) != 0] | 667 if (bit & sample_type) != 0] |
668 return Descriptor(fields) | 668 return Descriptor(fields) |
669 | 669 |
670 | 670 |
671 OBJDUMP_SECTION_HEADER_RE = re.compile( | 671 OBJDUMP_SECTION_HEADER_RE = re.compile( |
672 r"^\s*\d+\s(\.\S+)\s+[a-f0-9]") | 672 r"^\s*\d+\s(\.\S+)\s+[a-f0-9]") |
673 OBJDUMP_SYMBOL_LINE_RE = re.compile( | 673 OBJDUMP_SYMBOL_LINE_RE = re.compile( |
674 r"^([a-f0-9]+)\s(.{7})\s(\S+)\s+([a-f0-9]+)\s+(?:\.hidden\s+)?(.*)$") | 674 r"^([a-f0-9]+)\s(.{7})\s(\S+)\s+([a-f0-9]+)\s+(?:\.hidden\s+)?(.*)$") |
675 OBJDUMP_DYNAMIC_SYMBOLS_START_RE = re.compile( | 675 OBJDUMP_DYNAMIC_SYMBOLS_START_RE = re.compile( |
676 r"^DYNAMIC SYMBOL TABLE") | 676 r"^DYNAMIC SYMBOL TABLE") |
| 677 OBJDUMP_SKIP_RE = re.compile( |
| 678 r"^.*ld\.so\.cache$") |
677 KERNEL_ALLSYMS_FILE = "/proc/kallsyms" | 679 KERNEL_ALLSYMS_FILE = "/proc/kallsyms" |
678 PERF_KERNEL_ALLSYMS_RE = re.compile( | 680 PERF_KERNEL_ALLSYMS_RE = re.compile( |
679 r".*kallsyms.*") | 681 r".*kallsyms.*") |
680 KERNEL_ALLSYMS_LINE_RE = re.compile( | 682 KERNEL_ALLSYMS_LINE_RE = re.compile( |
681 r"^([a-f0-9]+)\s(?:t|T)\s(\S+)$") | 683 r"^([a-f0-9]+)\s(?:t|T)\s(\S+)$") |
682 | 684 |
683 | 685 |
684 class LibraryRepo(object): | 686 class LibraryRepo(object): |
685 def __init__(self): | 687 def __init__(self): |
686 self.infos = [] | 688 self.infos = [] |
687 self.names = set() | 689 self.names = set() |
688 self.ticks = {} | 690 self.ticks = {} |
689 | 691 |
690 def Load(self, mmap_info, code_map, options): | 692 def Load(self, mmap_info, code_map, options): |
691 # Skip kernel mmaps when requested using the fact that their tid | 693 # Skip kernel mmaps when requested using the fact that their tid |
692 # is 0. | 694 # is 0. |
693 if mmap_info.tid == 0 and not options.kernel: | 695 if mmap_info.tid == 0 and not options.kernel: |
694 return True | 696 return True |
| 697 if OBJDUMP_SKIP_RE.match(mmap_info.filename): |
| 698 return True |
695 if PERF_KERNEL_ALLSYMS_RE.match(mmap_info.filename): | 699 if PERF_KERNEL_ALLSYMS_RE.match(mmap_info.filename): |
696 return self._LoadKernelSymbols(code_map) | 700 return self._LoadKernelSymbols(code_map) |
697 self.infos.append(mmap_info) | 701 self.infos.append(mmap_info) |
698 mmap_info.ticks = 0 | 702 mmap_info.ticks = 0 |
699 mmap_info.unique_name = self._UniqueMmapName(mmap_info) | 703 mmap_info.unique_name = self._UniqueMmapName(mmap_info) |
700 if not os.path.exists(mmap_info.filename): | 704 if not os.path.exists(mmap_info.filename): |
701 return True | 705 return True |
702 # Request section headers (-h), symbols (-t), and dynamic symbols | 706 # Request section headers (-h), symbols (-t), and dynamic symbols |
703 # (-T) from objdump. | 707 # (-T) from objdump. |
704 # Unfortunately, section headers span two lines, so we have to | 708 # Unfortunately, section headers span two lines, so we have to |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 print "%10d total ticks" % ticks | 942 print "%10d total ticks" % ticks |
939 print "%10d ticks not in symbols" % missed_ticks | 943 print "%10d ticks not in symbols" % missed_ticks |
940 print "%10d unaccounted ticks" % really_missed_ticks | 944 print "%10d unaccounted ticks" % really_missed_ticks |
941 print "%10d total symbols" % len([c for c in code_map.AllCode()]) | 945 print "%10d total symbols" % len([c for c in code_map.AllCode()]) |
942 print "%10d used symbols" % len([c for c in code_map.UsedCode()]) | 946 print "%10d used symbols" % len([c for c in code_map.UsedCode()]) |
943 print "%9.2fs library processing time" % mmap_time | 947 print "%9.2fs library processing time" % mmap_time |
944 print "%9.2fs tick processing time" % sample_time | 948 print "%9.2fs tick processing time" % sample_time |
945 | 949 |
946 log_reader.Dispose() | 950 log_reader.Dispose() |
947 trace_reader.Dispose() | 951 trace_reader.Dispose() |
OLD | NEW |