王大治与董洁什么关系| 黄喉是什么动物身上的| 中暑头晕吃什么药| 龟粮什么牌子的好| 2012年什么年| 金字旁加匀念什么| 老花眼有什么症状| 玉什么样的好| 西洋参不能和什么一起吃| 无家可归是什么生肖| miss什么意思| 太阳穴长痘痘什么原因| 狸猫是什么动物| 发量少适合什么发型| 心脏跳的慢吃什么好| 荨麻疹吃什么药最管用| 什么是PC出轨| 鸡胸是什么原因引起的| 乌龟爱吃什么| 根是什么意思| 什么瓜不能吃脑筋急转弯| 长期便秘吃什么药好| 高湛为什么帮梅长苏| 淡紫色配什么颜色好看| 骨密度增高是什么意思| 胃肠蠕动慢吃什么药| 双职工是什么意思| 冷泡茶用什么茶叶| 812是什么意思| 指奸是什么意思| 乳化是什么意思| 三点水开念什么意思| cts是什么意思| 牙根变黑是什么原因| 嘴苦是什么情况| 真好是什么意思| 咽喉干燥是什么原因| 无法入睡是什么原因| 长期吃泡面有什么危害| 甲基硫菌灵治什么病| 梦见梯子是什么意思| 手指伸不直是什么原因| d二聚体是检查什么的| 乳腺结节是什么病| 玉竹有什么功效| 藏拙是什么意思| 鼻烟为什么没人吸了| 泄愤是什么意思| 祛火喝什么茶| 左眼跳是什么意思| 属相鸡与什么属相相合| 麦露迪女鞋什么档次| 午时是什么时间| 唾液酸是什么| 健康管理是干什么的| 以逸待劳是什么意思| 孟母三迁的故事告诉我们什么道理| 寒冷性荨麻疹是什么原因引起的| mc是什么| 农家一碗香是什么菜| 为什么叫基围虾| 被蚊子咬了涂什么| 再生纤维素纤维是什么| 施字五行属什么| 检查血糖挂什么科| 花木兰是什么朝代| 属虎五行属什么| 黑蚂蚁泡酒有什么功效| 牙周炎吃什么药| 显赫是什么意思| 肠胃炎吃什么抗生素| 老人嘴唇发紫是什么原因| 胆囊结石不宜吃什么| 两个圈的皮带是什么牌子| 高筋面粉可以做什么| 丝状疣用什么药膏最好| 砚是什么东西| 县委副书记是什么级别| 养肝护肝吃什么最好| 喝什么茶减肥最有效| 3.8什么星座| 圈癣是什么引起的| 吃红薯有什么好处和坏处| 白细胞计数高是什么原因| 青蛙怕什么| 预包装食品指的是什么| 胃胀吃什么药效果最好| 外人是什么意思| 转氨酶高吃什么好得快| yishion是什么牌子| 痛风都有什么症状| 小孩荨麻疹吃什么药| 顾名思义的顾是什么意思| 纸上谈兵是什么生肖| 保泰松是什么药| 嗳气是什么原因| 牙上有黑渍是什么原因| 什么样的智齿不需要拔| 母胎solo是什么意思| 双肺间质性改变是什么意思| 嘴巴淡而无味是什么原因| 阴道排气是什么原因| 徐五行属什么| 万亿后面是什么单位| 嫡传弟子是什么意思| 肠道有息肉有什么症状| 血糖高吃什么水果最好| 毕业是什么意思| 一个m是什么品牌| 土家族是什么族| 疳积是什么病| 烫伤用什么药膏| 白带黄吃什么药| 锑对人体有什么危害| 红玛瑙五行属什么| 艾司唑仑是什么药| 菠菜不能与什么一起吃| 双手发麻是什么病的前兆| 馒头配什么菜好吃| 每天坚持做俯卧撑有什么好处| 十恶不赦是什么意思| 拉屎黑色的是什么原因| 科目三为什么这么难| 勾践属什么生肖| 杵状指常见于什么病| 血糖高的可以吃什么水果| 利血平是什么药| 什么是反射| 儿童说话晚去医院挂什么科| 沉香是什么东西| 盐城有什么特产| 女人喜欢什么样的男人| 元五行属性是什么| 幽门螺杆菌阴性是什么意思| 九月二十号是什么星座| 刘姥姥和贾府什么关系| 撒野是什么意思| 不可或缺是什么意思| 早餐有什么| pd990是什么金| aldo是什么牌子| 脖子有痣代表什么意思| CHANDO是什么牌子的化妆品| 交界性心律是什么意思| 浮肿是什么原因造成的| 女生读什么技校好| 今年什么生肖年| 芥蒂是什么意思| 1.4什么星座| 肌酸激酶高是什么病| 力不从心什么意思| 74年出生属什么生肖| 全血低切相对指数偏高什么意思| 嘴巴里长水泡是什么原因| 脾胃虚弱吃什么药调理| 肺气虚吃什么食物| 慢性肠炎用什么药| 转氨酶高吃什么食物降得快| 湿气重吃什么药最好| 什么是文爱| 肠胃湿热吃什么药好| 补办身份证需要什么手续| 天麻炖什么治疗头痛效果最好| 夏天煲什么汤最好| 含羞草为什么会害羞| 球蛋白适合什么人打| 属猴的本命佛是什么佛| 抹茶粉是什么做的| 河虾最爱吃什么食物| 低压高是什么原因| 额头容易出汗是什么原因| 木耳有什么功效与作用| 什么叫985大学| 口臭吃什么中成药| 农历2月份是什么星座| 纪是什么意思| 吃什么 长高| 3f是什么意思| 羽字五行属什么的| 为什么老是| 拉屎肛门疼是什么原因| 跳蚤是什么样的图片| 姨妈来了吃什么水果好| 瑞什么意思| 褶皱是什么意思| 体寒是什么原因引起的| beaf什么意思| 腿部青筋明显是什么原因| 79年的羊是什么命| 乐话提醒业务是什么意思| 孩子咬手指甲是什么原因| 什么尾花| 愚孝什么意思| 拉稀吃什么药最有效果| 掌纹多而乱代表什么| 腰臀比是什么意思| 自制力是什么意思| 大便长期不成形是什么原因| 什么是自限性疾病| 东北小咬是什么虫子| 溺爱的意思是什么| 解绑是什么意思| 什么是激素脸| 胰腺不舒服是什么症状| 书字五行属什么的| 做完核磁共振后需要注意什么| 中指和无名指一样长代表什么| 公貔貅和母貔貅有什么区别| 什么是虫草| 和什么细什么的成语| 婴儿掉头发是什么原因| 花生属于什么类食物| 疣是什么病毒| amass是什么牌子| 什么字五行属金| 腋臭看什么科| 攻受是什么意思| 五七干校是什么意思| 人心叵测什么意思| 视网膜为什么会脱落| 清真是什么意思啊| 欢天喜地是什么生肖| hcv是什么病| 吃什么促进消化| bug是什么意思| 什么颜色加什么颜色等于棕色| 土豆不能和什么一起吃| 美宝莲属于什么档次| 什么是牙槽骨突出图片| 熟地黄是什么| 木林森属于什么档次| 接吻是什么感觉| 尿酸高不能吃什么蔬菜| 细菌感染吃什么消炎药| 汤姆是什么品种的猫| 报仇是什么意思| 怀孕要检查什么项目| 阴虚吃什么| 英气是什么意思| 桔子树用什么肥料最好| 拔牙后不能吃什么食物| 每天放屁多是什么原因| 股市xd是什么意思| 财主是什么意思| 洋葱有什么好处| 农历九月是什么月| 紧迫感是什么意思| 细菌感染吃什么消炎药| 黄体酮吃多了有什么副作用| 螺旋杆菌是什么病| 单核细胞比率偏高说明什么| 人体缺钾会有什么症状| 糖尿病的人可以吃什么水果| 玉仁玫白膏有什么功效| 星期六打喷嚏代表什么| 扬字五行属什么| 梦见茄子是什么意思| 包皮龟头炎用什么药膏| 电饭锅内胆是什么材质| 左旋肉碱什么时候吃| 急性肠胃炎可以吃什么食物| 寂灭是什么意思| 输卵管造影什么时候检查最好| 蜘蛛侠叫什么| 百度
blob: 848aa633687bfe62a51a07840f4f80abc3777e33 [file] [log] [blame]
#!/usr/bin/env python3
# Copyright 2024 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
from collections import defaultdict
DESCRIPTION = \
'''This script takes in a Chromium trace file and extracts info about Mojo
messages that were sent/received.
Trace files can be created using chrome://tracing or from passing
'--enable-tracing' to a Chrome or browser test executable. In the
chrome://tracing UI, ensure that the 'mojom' and 'toplevel' categories are
selected when setting up a new trace. Also, the trace events available will
have much more information (including message contents and return values) if
the executable generating the trace file is built with the
`extended_tracing_enabled = true` gn arg.
'''
PERFETTO_NOT_FOUND_HELP_TEXT = \
'''Error: perfetto module not found.
This script requires the perfetto Python module. To install it, use something
like `pip install perfetto`, or for Googlers on gLinux use the following (in a
Chromium checkout):
```
sudo apt-get install python3-venv
python3 -m venv venv
./venv/bin/python3 -mpip install perfetto
./venv/bin/python3 tools/mojo_messages_log.py <script args>
```
'''
# Note: Ignore 'mojo::Message::Message' (from the disabled by default 'mojom'
# category) because there is usually higher-level information that's more
# helpful, even in release builds.
# TODO(awillia): The 'Send mojo message' and 'Receive mojo sync reply' trace
# events (both from the toplevel.flow category) should have a message ID
# associated with them but I'm not sure how to access it. With the former we
# could figure out the sender of a message, but without the message ID the
# events aren't very helpful.
MOJO_EVENTS_QUERY = \
'''INCLUDE PERFETTO MODULE slices.with_context;
SELECT
(ts - (SELECT start_ts FROM trace_bounds)) / 1000000000.0 AS ts_delta,
process_name,
pid, -- Useful for distinguishing renderer processes
thread_name,
name,
category AS event_category,
GROUP_CONCAT(args.key || ": " ||
COALESCE(args.int_value,
args.string_value,
args.real_value)) AS parameters
-- Note that we could get argument type info as well if that's worthwhile
FROM thread_slice
LEFT JOIN args on args.arg_set_id = thread_slice.arg_set_id
WHERE (category IS 'mojom' AND name GLOB 'Send *') OR
(category IS 'mojom' AND name GLOB 'Call *') OR
(category IS 'toplevel' AND name GLOB 'Receive *') OR
(category IS 'toplevel' AND name IS 'Closed mojo endpoint')
GROUP BY thread_slice.id, args.arg_set_id
ORDER BY ts;
'''
SUMMARY_FIELDS = ['ts_delta', 'process_name', 'name']
VERBOSE_FIELDS = ['ts_delta', 'process_name', 'pid', 'thread_name', 'name']
ADDITIONAL_DATA_FIELDS = ['name', 'event_category', 'parameters']
def is_valid_path(parser, path):
if not os.path.exists(path):
parser.error("Invalid path: %s" % (path))
else:
return path
def process_mojo_msg_info(extra, spacing=2):
if not extra or len(extra) != len(ADDITIONAL_DATA_FIELDS):
return
output = ''
spacer = ' ' * spacing
event_name, event_category, parameters = extra
# The parameters exist as a single comma separated line, so break it into
# separate lines. Each if statement block here corresponds to a WHERE
# condition in the SQL query.
if (event_category == 'mojom' and event_name.startswith("Send ")) or \
(event_category == 'mojom' and event_name.startswith("Call ")):
if parameters is None:
# The call has no parameters
parameters = []
else:
assert (parameters.startswith('debug.'))
parameters = parameters.replace('debug.', '', 1)
parameters = parameters.split(',debug.')
elif (event_category == 'toplevel' and event_name.startswith("Receive ")) or \
(event_category == 'toplevel' and event_name == "Closed mojo endpoint"):
if parameters is None:
parameters = []
elif parameters.startswith('chrome_mojo_event_info.'):
parameters = parameters.replace('chrome_mojo_event_info.', '', 1)
parameters = parameters.split(',chrome_mojo_event_info.')
parameters = ['chrome_mojo_event_info.' + x for x in parameters]
else:
assert (parameters.startswith('args.'))
parameters = parameters.replace('args.', '', 1)
parameters = parameters.split(',args.')
results = defaultdict(lambda: [])
for parameter in parameters:
info_type, info = parameter.split('.', 1)
results[info_type].append(info)
for info_type in results:
output += spacer + info_type + ':\n'
for entry in results[info_type]:
output += spacer * 2 + entry + '\n'
return output
# Formats the event data into the structured data that can be shown in the
# displayed table and additional unstructured data that should be shown
# underneath each event.
def process_events(args, events):
rows = []
extras = []
for row_data in events:
row = []
extra = []
if args.summary:
for field in SUMMARY_FIELDS:
row.append(str(getattr(row_data, field)))
else:
for field in VERBOSE_FIELDS:
row.append(str(getattr(row_data, field)))
for field in ADDITIONAL_DATA_FIELDS:
extra.append(getattr(row_data, field))
extra = process_mojo_msg_info(extra)
rows.append(row)
extras.append(extra)
return rows, extras
try:
from perfetto.trace_processor import TraceProcessor
except ModuleNotFoundError:
print(PERFETTO_NOT_FOUND_HELP_TEXT)
sys.exit(1)
def main():
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=DESCRIPTION)
parser.add_argument('tracefile',
type=lambda path: is_valid_path(parser, path))
parser.add_argument('--summary', action="store_true")
args = parser.parse_args()
tp = TraceProcessor(file_path=args.tracefile)
results = tp.query(MOJO_EVENTS_QUERY)
rows, extras = process_events(args, results)
# Add headers for the table.
if args.summary:
rows.insert(0, SUMMARY_FIELDS)
else:
rows.insert(0, VERBOSE_FIELDS)
# Keep `extras` the same length as `rows`.
extras.insert(0, None)
# Calculate the appropriate widths of each column.
widths = [max(map(len, column)) for column in zip(*rows)]
for i in range(len(rows)):
row = rows[i]
extra = extras[i]
# Format the structured data so the fields align with the table headers.
out = (value.ljust(width) for value, width in zip(row, widths))
out = " ".join(out).rstrip()
print(out)
if extra:
print(extra)
if __name__ == '__main__':
sys.exit(main())
嘴里起泡是什么原因 3代表什么意思 孩子贫血吃什么补血最快 耳朵痒是什么原因引起的 紫河车是什么东西
什么是特需门诊 什么水果糖分最高 手总是发麻是什么原因 元气是什么意思 机器学习是什么
这个梗是什么意思 做空是什么意思啊 老鸹是什么鸟 女人手脚发热吃什么药 什么是流水
原位癌是什么意思 荷花是什么季节开的 ym是什么衣服品牌 月经提前十天是什么原因 口爆是什么
吃苹果什么意思hcv9jop1ns1r.cn 心功能不全是什么意思hcv9jop4ns2r.cn 卵泡回声什么意思hcv7jop6ns1r.cn 头疼挂什么科室hcv8jop0ns9r.cn 阴道炎是什么引起的hcv9jop6ns7r.cn
小孩喜欢趴着睡觉是什么原因baiqunet.com 一个牙一个合是什么字hcv8jop3ns4r.cn 什么星座最渣hcv9jop6ns5r.cn 核糖体由什么组成hcv9jop6ns3r.cn 手上长红点是什么原因travellingsim.com
吃什么东西最营养hcv9jop0ns8r.cn 亚专业是什么意思hkuteam.com 梦见放烟花是什么征兆hcv7jop7ns3r.cn 愚公移山是什么故事hcv7jop5ns3r.cn 刘邦和刘备什么关系hcv8jop2ns1r.cn
长痘痘涂什么药膏sanhestory.com 什么是尿崩症hcv8jop5ns2r.cn 胸闷气短呼吸困难心慌是什么原因hcv9jop1ns0r.cn 为什么虾煮熟了会变红hcv8jop5ns7r.cn 维生素b族什么时候吃效果最好hcv9jop0ns9r.cn
百度