OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import os | 6 import os |
7 import re | 7 import re |
8 import time | 8 import time |
9 | 9 |
10 from adb_profile_chrome import controllers | 10 from profile_chrome import controllers |
11 | 11 |
12 from pylib import pexpect | 12 from pylib import pexpect |
13 from pylib.device import intent | 13 from pylib.device import intent |
14 | 14 |
| 15 |
15 _HEAP_PROFILE_MMAP_PROPERTY = 'heapprof.mmap' | 16 _HEAP_PROFILE_MMAP_PROPERTY = 'heapprof.mmap' |
16 | 17 |
17 class ChromeTracingController(controllers.BaseController): | 18 class ChromeTracingController(controllers.BaseController): |
18 def __init__(self, device, package_info, | 19 def __init__(self, device, package_info, |
19 categories, ring_buffer, trace_memory=False): | 20 categories, ring_buffer, trace_memory=False): |
20 controllers.BaseController.__init__(self) | 21 controllers.BaseController.__init__(self) |
21 self._device = device | 22 self._device = device |
22 self._package_info = package_info | 23 self._package_info = package_info |
23 self._categories = categories | 24 self._categories = categories |
24 self._ring_buffer = ring_buffer | 25 self._ring_buffer = ring_buffer |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 self._device.SetProp(_HEAP_PROFILE_MMAP_PROPERTY, 0) | 94 self._device.SetProp(_HEAP_PROFILE_MMAP_PROPERTY, 0) |
94 | 95 |
95 def PullTrace(self): | 96 def PullTrace(self): |
96 # Wait a bit for the browser to finish writing the trace file. | 97 # Wait a bit for the browser to finish writing the trace file. |
97 time.sleep(self._trace_interval / 4 + 1) | 98 time.sleep(self._trace_interval / 4 + 1) |
98 | 99 |
99 trace_file = self._trace_file.replace('/storage/emulated/0/', '/sdcard/') | 100 trace_file = self._trace_file.replace('/storage/emulated/0/', '/sdcard/') |
100 host_file = os.path.join(os.path.curdir, os.path.basename(trace_file)) | 101 host_file = os.path.join(os.path.curdir, os.path.basename(trace_file)) |
101 self._device.PullFile(trace_file, host_file) | 102 self._device.PullFile(trace_file, host_file) |
102 return host_file | 103 return host_file |
OLD | NEW |