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

Side by Side Diff: tools/telemetry/third_party/coverage/lab/run_trace.py

Issue 1366913004: Add coverage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
3
4 """Run a simple trace function on a file of Python code."""
5
6 import os, sys
7
8 nest = 0
9
10 def trace(frame, event, arg):
11 global nest
12
13 if nest is None:
14 # This can happen when Python is shutting down.
15 return None
16
17 print "%s%s %s %d @%d" % (
18 " " * nest,
19 event,
20 os.path.basename(frame.f_code.co_filename),
21 frame.f_lineno,
22 frame.f_lasti,
23 )
24
25 if event == 'call':
26 nest += 1
27 if event == 'return':
28 nest -= 1
29
30 return trace
31
32 the_program = sys.argv[1]
33
34 sys.settrace(trace)
35 execfile(the_program)
OLDNEW
« no previous file with comments | « tools/telemetry/third_party/coverage/lab/platform_info.py ('k') | tools/telemetry/third_party/coverage/lab/show_platform.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698