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

Side by Side Diff: tools/isolate/trace_child_process.py

Issue 10536078: Enable parallel tracing support on Dtrace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | « no previous file | tools/isolate/trace_inputs.py » ('j') | 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Executes with the command to be run and optionally waits for the go signal. 6 """Executes with the command to be run and optionally waits for the go signal.
7 7
8 Not meant to be used directly, only meant to be used by trace_inputs.py. 8 Not meant to be used directly, only meant to be used by trace_inputs.py.
9 9
10 This script is used by the tracer as a signal for the log parser that the child 10 This script is used by the tracer as a signal for the log parser that the child
11 process is the process we care about. It is especially important on kernel based 11 process is the process we care about. It is especially important on kernel based
12 tracer because we want it to trace the relevant process tree. 12 tracer because we want it to trace the relevant process tree.
13 """ 13 """
14 14
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 17
18 18
19 def main(): 19 def main():
20 cmd = sys.argv[1:] 20 cmd = sys.argv[2:]
21 if sys.argv[1] == '--wait':
22 cmd = cmd[1:]
23 signal = 'Go!'
24 value = sys.stdin.read(len(signal))
25 assert value == signal
26 sys.stdin.close()
27 21
28 # The reason os.execve() is not used is that we don't want the modules 22 # The reason os.execve() is not used is that we don't want the modules
29 # imported here to influence the executable being traced, so we need a fresh 23 # imported here to influence the executable being traced, so we need a fresh
30 # pid and need to fork. 24 # pid and need to fork.
25 # TODO(maruel): Use CreateProcess() on Windows and fork manually on OSX.
31 return subprocess.call(cmd) 26 return subprocess.call(cmd)
32 27
33 28
34 if __name__ == '__main__': 29 if __name__ == '__main__':
35 sys.exit(main()) 30 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/isolate/trace_inputs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698