Browse Source

Specify if a node should use the google perf profiler

The 'google_cpu_profiler' will set the 'CPUPROFILE' environment
variable to a file path ('cpu-prof.out') in the node's directory.
Steven Engler 2 years ago
parent
commit
de95a383c1
1 changed files with 6 additions and 0 deletions
  1. 6 0
      lib/chutney/TorNet.py

+ 6 - 0
lib/chutney/TorNet.py

@@ -900,6 +900,11 @@ class LocalNodeController(NodeController):
             cmdline.append('--log-file={}'.format(self._env['valgrind_log']))
         #
         add_environ_vars = self._env['add_environ_vars']
+        if add_environ_vars is not None:
+            add_environ_vars = add_environ_vars.copy()
+        #
+        if self._env['google_cpu_profiler'] is True:
+            add_environ_vars['CPUPROFILE'] = os.path.join(self._env['dir'], 'cpu-prof.out')
         #
         cmdline.extend([
             tor_path,
@@ -1101,6 +1106,7 @@ DEFAULTS = {
     'valgrind_settings': None,
     'add_environ_vars': None,
     'log_files': ['notice', 'info', 'debug'],
+    'google_cpu_profiler': False,
 }