| 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 2012 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 |
| 11 # copyright notice, this list of conditions and the following | 11 # copyright notice, this list of conditions and the following |
| 12 # disclaimer in the documentation and/or other materials provided | 12 # disclaimer in the documentation and/or other materials provided |
| 13 # with the distribution. | 13 # with the distribution. |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 if section in code_sections: | 740 if section in code_sections: |
| 741 if dynamic or section in reloc_sections: | 741 if dynamic or section in reloc_sections: |
| 742 start_address += mmap_info.addr | 742 start_address += mmap_info.addr |
| 743 size = int(match.group(4), 16) | 743 size = int(match.group(4), 16) |
| 744 name = match.group(5) | 744 name = match.group(5) |
| 745 origin = mmap_info.filename | 745 origin = mmap_info.filename |
| 746 code_map.Add(Code(name, start_address, start_address + size, | 746 code_map.Add(Code(name, start_address, start_address + size, |
| 747 origin, origin_offset)) | 747 origin, origin_offset)) |
| 748 finally: | 748 finally: |
| 749 pipe.close() | 749 pipe.close() |
| 750 assert process.wait() == 0, "Failed to objdump %s" % mmap_info.filename | 750 if process.wait() != 0: |
| 751 print "Warning: Failed to objdump %s" % mmap_info.filename |
| 751 | 752 |
| 752 def Tick(self, pc): | 753 def Tick(self, pc): |
| 753 for i, mmap_info in enumerate(self.infos): | 754 for i, mmap_info in enumerate(self.infos): |
| 754 if mmap_info.addr <= pc < (mmap_info.addr + mmap_info.len): | 755 if mmap_info.addr <= pc < (mmap_info.addr + mmap_info.len): |
| 755 mmap_info.ticks += 1 | 756 mmap_info.ticks += 1 |
| 756 self.infos[0], self.infos[i] = mmap_info, self.infos[0] | 757 self.infos[0], self.infos[i] = mmap_info, self.infos[0] |
| 757 return True | 758 return True |
| 758 return False | 759 return False |
| 759 | 760 |
| 760 def _UniqueMmapName(self, mmap_info): | 761 def _UniqueMmapName(self, mmap_info): |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 print "%10d total ticks" % ticks | 939 print "%10d total ticks" % ticks |
| 939 print "%10d ticks not in symbols" % missed_ticks | 940 print "%10d ticks not in symbols" % missed_ticks |
| 940 print "%10d unaccounted ticks" % really_missed_ticks | 941 print "%10d unaccounted ticks" % really_missed_ticks |
| 941 print "%10d total symbols" % len([c for c in code_map.AllCode()]) | 942 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()]) | 943 print "%10d used symbols" % len([c for c in code_map.UsedCode()]) |
| 943 print "%9.2fs library processing time" % mmap_time | 944 print "%9.2fs library processing time" % mmap_time |
| 944 print "%9.2fs tick processing time" % sample_time | 945 print "%9.2fs tick processing time" % sample_time |
| 945 | 946 |
| 946 log_reader.Dispose() | 947 log_reader.Dispose() |
| 947 trace_reader.Dispose() | 948 trace_reader.Dispose() |
| OLD | NEW |