feat(tpc): llc 编译阶段日志带进度/源文件/耗时

- 用户反馈 SUCCESS: xxx.ll 只有 sha1 看不到对应源文件与进度
- 改为 '[i/N] sha1.ll  源文件相对路径 (耗时s)'(sha1_map 反查源文件,提交时刻计时含排队)
This commit is contained in:
TermiNexus committed 2026-08-22 08:05:19 +08:00
1 parent 7b04b72d4b
commit 1dc23ffdde
1 file changed
+12 -3
+12 -3
View File
@@ -2091,14 +2091,23 @@ class Phase2Translator:
n_workers = _PickWorkerCount(len(need_compile), 400)
_vlog().info(f" 并行编译 {len(need_compile)} 个文件 (workers={n_workers})")
errors = []
_compile_total = len(need_compile)
_compile_done = 0
with ThreadPoolExecutor(max_workers=n_workers) as executor:
futures = {executor.submit(_compile_one, ll_path): ll_path for ll_path in need_compile}
futures = {}
for ll_path in need_compile:
futures[executor.submit(_compile_one, ll_path)] = (ll_path, time.time())
for future in as_completed(futures):
ll_path, _t_sub = futures[future]
rel, status, err = future.result()
_compile_done += 1
_elapsed_c = time.time() - _t_sub
_sha1_c = os.path.basename(ll_path)[:-3]
_src_c = self.sha1_map.get(_sha1_c, '?')
if status == 'ok':
_vlog().success(f" {rel}")
_vlog().success(f" [{_compile_done}/{_compile_total}] {os.path.basename(ll_path)} {_src_c} ({_elapsed_c:.1f}s)")
elif status == 'error':
_vlog().error(f" {rel}: {err}")
_vlog().error(f" [{_compile_done}/{_compile_total}] {rel}: {err}")
errors.append((rel, err))
elif status == 'cached':
pass