feat(hotspot)!: 下线 --func-hotspot 并为 --hotspot-sites 增加每函数计时器
移除 --func-hotspot 全链路(CLI 解析与绑定、Config argparse 与注入、Translator 属性、LlvmGenerator 收口与透传、BaseGen 专属实现、Phase2Translator 透传、帮助文本);全仓已无 FuncHotspot/func-hotspot 残留引用。 通用截断逻辑保留并改名为 _InstallHotspotTruncate,供 --hotspot-sites 使用(分别清空 hotspot_sites.txt 与 hotspot_time.txt);ctor 注册改为直接新建并接收处理器列表(sites 与 time 两个处理器在同一 ctor 内注册)。 --hotspot-sites 现附带每函数计时:入口读一次 @llvm.readcyclecounter() 存起始 tick,在函数所有 ret 之前再读一次并累加差值到 internal i64 __fhs_ftime_N,同时 __fhs_ftime_enter_N 记录进入次数;单位为 tick(x86_64 即 CPU 周期),语义为 inclusive(包含内层调用)。 计时结果按耗时降序写入同目录 hotspot_time.txt(# time <module_sha1> 分段 + 函数名/累计 tick/进入次数),不改变 hotspot_sites.txt 的既有格式与字段。不传 --hotspot-sites 时零影响。
This commit is contained in:
1 parent
2021c0edb7
commit
fc5a6134ca
7 files changed
+359
-356
No files matched your search
+3
-13
@@ -332,14 +332,6 @@ class TransPyC:
|
||||
else:
|
||||
error('--datalayout requires an argument')
|
||||
sys.exit(1)
|
||||
elif sys.argv[I] == '--func-hotspot':
|
||||
# 函数热点统计:为每个函数定义配 u64 计数器,Ctrl+C 时写入指定文件
|
||||
if I + 1 < len(sys.argv):
|
||||
self.Args['FuncHotspot'] = sys.argv[I + 1]
|
||||
I += 2
|
||||
else:
|
||||
error('--func-hotspot requires an argument')
|
||||
sys.exit(1)
|
||||
elif sys.argv[I] == '--hotspot-sites':
|
||||
# 调用点热点统计:可选路径(省略时默认 hotspot_sites.txt,运行期由
|
||||
# 处理器按计数降序写入)。空串表示"已启用但未给路径"。
|
||||
@@ -628,11 +620,9 @@ class TransPyC:
|
||||
# 有命令行参数,使用 ParseArgs 方法解析
|
||||
self.ParseArgs()
|
||||
|
||||
# 函数热点统计(--func-hotspot):绑定到翻译器;未传时为 None(零影响)
|
||||
self.translator.FuncHotspotFile = self.Args.get('FuncHotspot')
|
||||
|
||||
# 调用点热点统计(--hotspot-sites):None=未启用(零影响);''=启用但未给
|
||||
# 路径(默认 hotspot_sites.txt)。注册走种子单模块路径(main 入口注册)。
|
||||
# 调用点热点统计与每函数计时(--hotspot-sites):None=未启用(零影响);
|
||||
# ''=启用但未给路径(默认 hotspot_sites.txt)。注册走种子单模块路径
|
||||
# (main 入口注册);计时结果写到同目录 hotspot_time.txt。
|
||||
HotspotSites: str | None = self.Args.get('HotspotSites')
|
||||
if HotspotSites is not None:
|
||||
if HotspotSites == '':
|
||||
|
||||
Reference in new issue
Block a user