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

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

Issue 10541083: Use a larger dtrace kernel buffer (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 | 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 # coding=utf-8 2 # coding=utf-8
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Traces an executable and its child processes and extract the files accessed 7 """Traces an executable and its child processes and extract the files accessed
8 by them. 8 by them.
9 9
10 The implementation uses OS-specific API. The native Kernel logger and the ETL 10 The implementation uses OS-specific API. The native Kernel logger and the ETL
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 # but works fine enough. 1680 # but works fine enough.
1681 self._dummy_file_id, self._dummy_file_name = tempfile.mkstemp( 1681 self._dummy_file_id, self._dummy_file_name = tempfile.mkstemp(
1682 prefix='trace_signal_file') 1682 prefix='trace_signal_file')
1683 1683
1684 # Note: do not use the -p flag. It's useless if the initial process quits 1684 # Note: do not use the -p flag. It's useless if the initial process quits
1685 # too fast, resulting in missing traces from the grand-children. The D 1685 # too fast, resulting in missing traces from the grand-children. The D
1686 # code manages the dtrace lifetime itself. 1686 # code manages the dtrace lifetime itself.
1687 trace_cmd = [ 1687 trace_cmd = [
1688 'sudo', 1688 'sudo',
1689 'dtrace', 1689 'dtrace',
1690 '-x', 'dynvarsize=4m', 1690 # Use a larger buffer if getting 'out of scratch space' errors.
1691 # Ref: https://wikis.oracle.com/display/DTrace/Options+and+Tunables
1692 '-b', '10m',
1693 '-x', 'dynvarsize=10m',
1694 #'-x', 'dtrace_global_maxsize=1m',
1691 '-x', 'evaltime=exec', 1695 '-x', 'evaltime=exec',
1692 '-o', '/dev/stderr', 1696 '-o', '/dev/stderr',
1693 '-q', 1697 '-q',
1694 '-n', self._get_dtrace_code(), 1698 '-n', self._get_dtrace_code(),
1695 ] 1699 ]
1696 with open(self._logname + '.log', 'wb') as logfile: 1700 with open(self._logname + '.log', 'wb') as logfile:
1697 self._dtrace = subprocess.Popen( 1701 self._dtrace = subprocess.Popen(
1698 trace_cmd, stdout=logfile, stderr=subprocess.STDOUT) 1702 trace_cmd, stdout=logfile, stderr=subprocess.STDOUT)
1699 logging.debug('Started dtrace pid: %d' % self._dtrace.pid) 1703 logging.debug('Started dtrace pid: %d' % self._dtrace.pid)
1700 1704
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 for fn in dir(sys.modules[__name__]) 2793 for fn in dir(sys.modules[__name__])
2790 if fn.startswith('CMD'))) 2794 if fn.startswith('CMD')))
2791 2795
2792 command = get_command_handler(argv[0] if argv else None) 2796 command = get_command_handler(argv[0] if argv else None)
2793 parser = gen_parser(command) 2797 parser = gen_parser(command)
2794 return command(parser, argv[1:]) 2798 return command(parser, argv[1:])
2795 2799
2796 2800
2797 if __name__ == '__main__': 2801 if __name__ == '__main__':
2798 sys.exit(main(sys.argv[1:])) 2802 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698