diff --git a/tools/debugger/prompt/prompt.cc b/tools/debugger/prompt/prompt.cc index 0432d09f9df..23f1c5dfb80 100644 --- a/tools/debugger/prompt/prompt.cc +++ b/tools/debugger/prompt/prompt.cc @@ -178,7 +178,7 @@ class Prompt : public mojo::ApplicationDelegate, void StartProfiling(int connection_id) { base::debug::StartProfiling("sky_viewer.pprof"); - Respond(connection_id, "Starting profiling (type 'stop_profiling' to stop"); + Respond(connection_id, "Starting profiling (stop with 'stop_profiling')"); } void StopProfiling(int connection_id) { diff --git a/tools/skydb b/tools/skydb index ab84fae44b9..5a5c836f9bc 100755 --- a/tools/skydb +++ b/tools/skydb @@ -320,6 +320,16 @@ class SkyDebugger(object): url = args.url_or_path self._send_command_to_sky('/load', url) + def stop_profiling_command(self, args): + self._send_command_to_sky('/stop_profiling') + # We need to munge the profile to replace foo.mojo with libfoo.so so + # that pprof knows this represents an SO. + with open("sky_viewer.pprof", "r+") as profile_file: + data = profile_file.read() + profile_file.seek(0) + profile_file.write(re.sub(r'(\w+)\.mojo', r'lib\1_library.so', data)) + profile_file.truncate() + def _command_base_url(self): return 'http://localhost:%s' % self.pids['sky_command_port'] @@ -507,8 +517,10 @@ class SkyDebugger(object): 'stop the running sky instance') self._add_basic_command(subparsers, 'start_profiling', '/start_profiling', 'starts profiling the running sky instance (Linux only)') - self._add_basic_command(subparsers, 'stop_profiling', '/stop_profiling', - 'stios profiling the running sky instance (Linux only)') + + stop_profiling_parser = subparsers.add_parser('stop_profiling', + help='stops profiling the running sky instance (Linux only)') + stop_profiling_parser.set_defaults(func=self.stop_profiling_command) load_parser = subparsers.add_parser('load', help='load a new page in the currently running sky')