OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 from skypy.skyserver import SkyServer | 6 from skypy.skyserver import SkyServer |
7 import argparse | 7 import argparse |
8 import json | 8 import json |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 # TODO(eseidel): Does not work for android. | 349 # TODO(eseidel): Does not work for android. |
350 mojo_map_path = "/tmp/mojo_shell.%d.maps" % self.pids['mojo_shell_pid'] | 350 mojo_map_path = "/tmp/mojo_shell.%d.maps" % self.pids['mojo_shell_pid'] |
351 with open(mojo_map_path, 'r') as maps_file: | 351 with open(mojo_map_path, 'r') as maps_file: |
352 lines = maps_file.read().strip().split('\n') | 352 lines = maps_file.read().strip().split('\n') |
353 return dict(map(lambda line: line.split(' '), lines)) | 353 return dict(map(lambda line: line.split(' '), lines)) |
354 | 354 |
355 def stop_tracing_command(self, args): | 355 def stop_tracing_command(self, args): |
356 file_name = args.file_name | 356 file_name = args.file_name |
357 trace = self._send_command_to_sky('/stop_tracing').content | 357 trace = self._send_command_to_sky('/stop_tracing').content |
358 with open(file_name, "wb") as trace_file: | 358 with open(file_name, "wb") as trace_file: |
| 359 trace_file.write('{"traceEvents":[') |
359 trace_file.write(trace) | 360 trace_file.write(trace) |
| 361 trace_file.write(']}') |
360 print "Trace saved in %s" % file_name | 362 print "Trace saved in %s" % file_name |
361 | 363 |
362 def stop_profiling_command(self, args): | 364 def stop_profiling_command(self, args): |
363 self._run_basic_command('/stop_profiling') | 365 self._run_basic_command('/stop_profiling') |
364 mojo_map = self._read_mojo_map() | 366 mojo_map = self._read_mojo_map() |
365 | 367 |
366 # TODO(eseidel): We should have a helper for resolving urls, etc. | 368 # TODO(eseidel): We should have a helper for resolving urls, etc. |
367 remote_server_port = self.pids.get('remote_sky_server_port', self.pids['
sky_server_port']) | 369 remote_server_port = self.pids.get('remote_sky_server_port', self.pids['
sky_server_port']) |
368 build_dir_url = SkyServer.url_for_path( | 370 build_dir_url = SkyServer.url_for_path( |
369 remote_server_port, | 371 remote_server_port, |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 load_parser.set_defaults(func=self.load_command) | 616 load_parser.set_defaults(func=self.load_command) |
615 | 617 |
616 args = parser.parse_args() | 618 args = parser.parse_args() |
617 args.func(args) | 619 args.func(args) |
618 | 620 |
619 self._write_pid_file(PID_FILE_PATH, self.pids) | 621 self._write_pid_file(PID_FILE_PATH, self.pids) |
620 | 622 |
621 | 623 |
622 if __name__ == '__main__': | 624 if __name__ == '__main__': |
623 SkyDebugger().main() | 625 SkyDebugger().main() |
OLD | NEW |