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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 if self.offset >= self.limit: | 624 if self.offset >= self.limit: |
625 return None, 0 | 625 return None, 0 |
626 offset = self.offset | 626 offset = self.offset |
627 header = PERF_EVENT_HEADER_DESC.Read(self.trace, self.offset) | 627 header = PERF_EVENT_HEADER_DESC.Read(self.trace, self.offset) |
628 self.offset += header.size | 628 self.offset += header.size |
629 return header, offset | 629 return header, offset |
630 | 630 |
631 def ReadMmap(self, header, offset): | 631 def ReadMmap(self, header, offset): |
632 mmap_info = PERF_MMAP_EVENT_BODY_DESC.Read(self.trace, | 632 mmap_info = PERF_MMAP_EVENT_BODY_DESC.Read(self.trace, |
633 offset + self.header_size) | 633 offset + self.header_size) |
634 # Read null-padded filename. | 634 # Read null-terminated filename. |
635 filename = self.trace[offset + self.header_size + ctypes.sizeof(mmap_info): | 635 filename = self.trace[offset + self.header_size + ctypes.sizeof(mmap_info): |
636 offset + header.size].rstrip(chr(0)) | 636 offset + header.size] |
637 mmap_info.filename = filename | 637 mmap_info.filename = filename[:filename.find(chr(0))] |
638 return mmap_info | 638 return mmap_info |
639 | 639 |
640 def ReadSample(self, header, offset): | 640 def ReadSample(self, header, offset): |
641 sample = self.sample_event_body_desc.Read(self.trace, | 641 sample = self.sample_event_body_desc.Read(self.trace, |
642 offset + self.header_size) | 642 offset + self.header_size) |
643 if not self.callchain_supported: | 643 if not self.callchain_supported: |
644 return sample | 644 return sample |
645 sample.ips = [] | 645 sample.ips = [] |
646 offset += self.header_size + ctypes.sizeof(sample) | 646 offset += self.header_size + ctypes.sizeof(sample) |
647 for _ in xrange(sample.nr): | 647 for _ in xrange(sample.nr): |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 print "%10d total ticks" % ticks | 933 print "%10d total ticks" % ticks |
934 print "%10d ticks not in symbols" % missed_ticks | 934 print "%10d ticks not in symbols" % missed_ticks |
935 print "%10d unaccounted ticks" % really_missed_ticks | 935 print "%10d unaccounted ticks" % really_missed_ticks |
936 print "%10d total symbols" % len([c for c in code_map.AllCode()]) | 936 print "%10d total symbols" % len([c for c in code_map.AllCode()]) |
937 print "%10d used symbols" % len([c for c in code_map.UsedCode()]) | 937 print "%10d used symbols" % len([c for c in code_map.UsedCode()]) |
938 print "%9.2fs library processing time" % mmap_time | 938 print "%9.2fs library processing time" % mmap_time |
939 print "%9.2fs tick processing time" % sample_time | 939 print "%9.2fs tick processing time" % sample_time |
940 | 940 |
941 log_reader.Dispose() | 941 log_reader.Dispose() |
942 trace_reader.Dispose() | 942 trace_reader.Dispose() |
OLD | NEW |