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

Side by Side Diff: tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper.py

Issue 358993003: [Android] Switch to DeviceUtils versions of file functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
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 glob 5 import glob
6 import hashlib 6 import hashlib
7 import logging 7 import logging
8 import os 8 import os
9 import platform 9 import platform
10 import re 10 import re
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 # speed things up, only pull files that don't match copies we already 190 # speed things up, only pull files that don't match copies we already
191 # have in the symfs. 191 # have in the symfs.
192 if not device_dir in mismatching_files: 192 if not device_dir in mismatching_files:
193 changed_files = device.old_interface.GetFilesChanged(output_dir, 193 changed_files = device.old_interface.GetFilesChanged(output_dir,
194 device_dir) 194 device_dir)
195 mismatching_files[device_dir] = [ 195 mismatching_files[device_dir] = [
196 device_path for _, device_path in changed_files] 196 device_path for _, device_path in changed_files]
197 197
198 if not os.path.exists(output_lib) or lib in mismatching_files[device_dir]: 198 if not os.path.exists(output_lib) or lib in mismatching_files[device_dir]:
199 logging.info('Pulling %s to %s' % (lib, output_lib)) 199 logging.info('Pulling %s to %s' % (lib, output_lib))
200 device.old_interface.PullFileFromDevice(lib, output_lib) 200 device.PullFile(lib, output_lib)
201 201
202 # Also pull a copy of the kernel symbols. 202 # Also pull a copy of the kernel symbols.
203 output_kallsyms = os.path.join(symfs_dir, 'kallsyms') 203 output_kallsyms = os.path.join(symfs_dir, 'kallsyms')
204 if not os.path.exists(output_kallsyms): 204 if not os.path.exists(output_kallsyms):
205 device.old_interface.PullFileFromDevice('/proc/kallsyms', output_kallsyms) 205 device.PullFile('/proc/kallsyms', output_kallsyms)
206 return output_kallsyms 206 return output_kallsyms
207 207
208 208
209 def PrepareDeviceForPerf(device): 209 def PrepareDeviceForPerf(device):
210 """Set up a device for running perf. 210 """Set up a device for running perf.
211 211
212 Args: 212 Args:
213 device: DeviceUtils instance identifying the target device. 213 device: DeviceUtils instance identifying the target device.
214 214
215 Returns: 215 Returns:
216 The path to the installed perf binary on the device. 216 The path to the installed perf binary on the device.
217 """ 217 """
218 android_prebuilt_profiler_helper.InstallOnDevice(device, 'perf') 218 android_prebuilt_profiler_helper.InstallOnDevice(device, 'perf')
219 # Make sure kernel pointers are not hidden. 219 # Make sure kernel pointers are not hidden.
220 device.old_interface.SetProtectedFileContents( 220 device.WriteFile('/proc/sys/kernel/kptr_restrict', '0', as_root=True)
221 '/proc/sys/kernel/kptr_restrict', '0')
222 return android_prebuilt_profiler_helper.GetDevicePath('perf') 221 return android_prebuilt_profiler_helper.GetDevicePath('perf')
223 222
224 223
225 def GetToolchainBinaryPath(library_file, binary_name): 224 def GetToolchainBinaryPath(library_file, binary_name):
226 """Return the path to an Android toolchain binary on the host. 225 """Return the path to an Android toolchain binary on the host.
227 226
228 Args: 227 Args:
229 library_file: ELF library which is used to identify the used ABI, 228 library_file: ELF library which is used to identify the used ABI,
230 architecture and toolchain. 229 architecture and toolchain.
231 binary_name: Binary to search for, e.g., 'objdump' 230 binary_name: Binary to search for, e.g., 'objdump'
(...skipping 19 matching lines...) Expand all
251 return None 250 return None
252 toolchain_version = toolchain_version.group(1) 251 toolchain_version = toolchain_version.group(1)
253 252
254 path = os.path.join(util.GetChromiumSrcDir(), 'third_party', 'android_tools', 253 path = os.path.join(util.GetChromiumSrcDir(), 'third_party', 'android_tools',
255 'ndk', 'toolchains', 254 'ndk', 'toolchains',
256 '%s-%s' % (toolchain_config, toolchain_version), 255 '%s-%s' % (toolchain_config, toolchain_version),
257 'prebuilt', '%s-%s' % (host_os, host_machine), 'bin', 256 'prebuilt', '%s-%s' % (host_os, host_machine), 'bin',
258 '%s-%s' % (toolchain_config, binary_name)) 257 '%s-%s' % (toolchain_config, binary_name))
259 path = os.path.abspath(path) 258 path = os.path.abspath(path)
260 return path if os.path.exists(path) else None 259 return path if os.path.exists(path) else None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698