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

Side by Side Diff: tools/linux-tick-processor.py

Issue 7864: Incorporate patches by Paolo Giarrusso to allow profiling... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 | « src/objects-inl.h ('k') | 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2008 the V8 project authors. All rights reserved. 3 # Copyright 2008 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 12 matching lines...) Expand all
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 # Usage: process-ticks.py <logfile> 30 # Usage: process-ticks.py <logfile>
31 # Where <logfile> is the log file name (eg, v8.log). 31 # Where <logfile> is the log file name (eg, v8.log).
32 32
33 import os, re, sys, tickprocessor, getopt; 33 import subprocess, re, sys, tickprocessor, getopt
34 34
35 class LinuxTickProcessor(tickprocessor.TickProcessor): 35 class LinuxTickProcessor(tickprocessor.TickProcessor):
36 36
37 def ParseVMSymbols(self, filename, start, end): 37 def ParseVMSymbols(self, filename, start, end):
38 """Extract symbols and add them to the cpp entries.""" 38 """Extract symbols and add them to the cpp entries."""
39 pipe = os.popen('nm -n %s | c++filt' % filename, 'r') 39 # Extra both dynamic and non-dynamic symbols.
40 command = 'nm -C -n "%s"; nm -C -n -D "%s"' % (filename, filename)
41 process = subprocess.Popen(command, shell=True,
42 stdout=subprocess.PIPE,
43 stderr=subprocess.STDOUT)
44 pipe = process.stdout
40 try: 45 try:
41 for line in pipe: 46 for line in pipe:
42 row = re.match('^([0-9a-fA-F]{8}) . (.*)$', line) 47 row = re.match('^([0-9a-fA-F]{8}) . (.*)$', line)
43 if row: 48 if row:
44 addr = int(row.group(1), 16) 49 addr = int(row.group(1), 16)
45 if addr < start and addr < end - start: 50 if addr < start and addr < end - start:
46 addr += start 51 addr += start
47 self.cpp_entries.Insert(addr, tickprocessor.CodeEntry(addr, row.group( 2))) 52 self.cpp_entries.Insert(addr, tickprocessor.CodeEntry(addr, row.group( 2)))
48 finally: 53 finally:
49 pipe.close() 54 pipe.close()
(...skipping 22 matching lines...) Expand all
72 state = 3 77 state = 3
73 # do the processing. 78 # do the processing.
74 if len(args) != 1: 79 if len(args) != 1:
75 Usage(); 80 Usage();
76 tick_processor = LinuxTickProcessor() 81 tick_processor = LinuxTickProcessor()
77 tick_processor.ProcessLogfile(args[0], state) 82 tick_processor.ProcessLogfile(args[0], state)
78 tick_processor.PrintResults() 83 tick_processor.PrintResults()
79 84
80 if __name__ == '__main__': 85 if __name__ == '__main__':
81 Main() 86 Main()
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698