2 Star 0 Fork 0

chromium_develop/chromium_tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test_utils.py 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
李想 提交于 2022-08-16 16:29 +08:00 . chromium origin init
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test utilities for cygprofile scripts."""
import collections
import process_profiles
# Used by ProfileFile to generate unique file names.
_FILE_COUNTER = 0
SimpleTestSymbol = collections.namedtuple(
'SimpleTestSymbol', ['name', 'offset', 'size'])
class TestSymbolOffsetProcessor(process_profiles.SymbolOffsetProcessor):
def __init__(self, symbol_infos):
super(TestSymbolOffsetProcessor, self).__init__(None)
self._symbol_infos = symbol_infos
class TestProfileManager(process_profiles.ProfileManager):
def __init__(self, filecontents_mapping):
super(TestProfileManager, self).__init__(filecontents_mapping.keys())
self._filecontents_mapping = filecontents_mapping
def _ReadOffsets(self, filename):
return self._filecontents_mapping[filename]
def _ReadJSON(self, filename):
return self._filecontents_mapping[filename]
def ProfileFile(timestamp_sec, phase, process_name=None):
global _FILE_COUNTER
_FILE_COUNTER += 1
if process_name:
name_str = process_name + '-'
else:
name_str = ''
return 'test-directory/profile-hitmap-{}{}-{}.txt_{}'.format(
name_str, _FILE_COUNTER, timestamp_sec * 1000 * 1000 * 1000, phase)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chromium_develop/chromium_tools.git
git@gitee.com:chromium_develop/chromium_tools.git
chromium_develop
chromium_tools
chromium_tools
master

搜索帮助