Lines Matching full:path
25 import os.path
26 from pathlib import Path
42 def __init__(self, binary_dir: Path): argument
45 def get_path_in_cache(self, device_path: str, build_id: str) -> Path:
46 """ Given a binary path in perf.data, return its corresponding path in the cache.
53 # For elf file without build id, we can only follow its path on device. Otherwise,
57 # 2) It may exceed path limit on windows.
61 return Path(os.path.join(self.binary_dir, device_path))
72 binaries: maps from binary path to its build_id in perf.data.
76 def read_build_id(self, path: Path): argument
77 return self.readelf.get_build_id(path)
90 for path, build_id in binaries.items():
91 self.collect_binary(path, build_id, binary_cache)
94 def collect_binary(self, path: str, build_id: str, binary_cache: BinaryCache):
95 if not path.startswith('/') or path == "//anon" or path.startswith("/dev/"):
98 binary_cache_file = binary_cache.get_path_in_cache(path, build_id)
99 self.check_and_pull_binary(path, build_id, binary_cache_file)
101 def check_and_pull_binary(self, path: str, expected_build_id: str, binary_cache_file: Path): argument
110 logging.info('pull file to binary_cache: %s to %s', path, binary_cache_file)
116 success = self.pull_file_from_device(path, binary_cache_file)
121 logging.warning('failed to pull %s from device', path)
123 def pull_file_from_device(self, device_path: str, host_path: Path) -> bool: argument
135 def pull_kernel_symbols(self, file_path: Path): argument
146 def __init__(self, readelf: ReadElf, lib_dirs: List[Path]): argument
168 for path, build_id in binaries.items():
169 index = path.rfind('/')
170 filename = path[index + 1:]
171 self.filename_map[filename].append((path, build_id))
174 """ Create a map mapping from build id to binary path. """
176 for path, build_id in binaries.items():
178 self.build_id_map[build_id] = path
180 def is_platform_symbols_dir(self, lib_dir: Path): argument
185 def search_platform_symbols_dir(self, lib_dir: Path): argument
195 file_path = Path(os.path.join(root, filename))
197 for path, expected_build_id in binaries:
199 self.copy_to_binary_cache(file_path, build_id, path)
201 def search_dir(self, lib_dir: Path): argument
209 file_path = Path(os.path.join(root, filename))
218 for path, expected_build_id in self.filename_map.get(filename, []):
220 self.copy_to_binary_cache(file_path, '', path)
224 self, from_path: Path, expected_build_id: str, device_path: str): argument
235 def need_to_copy(self, from_path: Path, to_path: Path, expected_build_id: str): argument
240 def get_file_stripped_level(self, path: Path) -> int: argument
242 sections = self.readelf.get_sections(path)
256 self.binary_cache_dir = Path('binary_cache')
260 def build_binary_cache(self, perf_data_path: str, symfs_dirs: List[Union[Path, str]], argument
317 def copy_binaries_from_symfs_dirs(self, symfs_dirs: List[Union[str, Path]]) -> bool: argument
319 lib_dirs: List[Path] = []
322 symfs_dir = Path(symfs_dir)
336 path.
343 path = Path(os.path.join(root, filename))
344 build_id = self.readelf.get_build_id(path)
346 relative_path = path.relative_to(self.binary_cache_dir)
350 def find_path_in_cache(self, device_path: str) -> Optional[Path]:
359 The path of profiling data.""")
361 Path to find debug version of native shared libraries used in the app.""", action='append')
364 parser.add_argument('--ndk_path', nargs=1, help='Find tools in the ndk path.')