diff --git a/App/lib/Phase/Phase2/__init__.vp b/App/lib/Phase/Phase2/__init__.vp index 90fca2e..c08d08b 100644 --- a/App/lib/Phase/Phase2/__init__.vp +++ b/App/lib/Phase/Phase2/__init__.vp @@ -927,6 +927,8 @@ def RunMultiFileProject(mb: memhub.MemBuddy | t.CPtr, ent: SrcFileEntry | t.CPtr = (SrcFileEntry | t.CPtr)(t.CVoid(ea, t.CPtr)) if ent is None or ent.Path is None or ent.Sha1 is None: continue + # 单文件三步计时起点(GetTickCount64,ms) + t_pb0: t.CUInt64T = w32.win32base.GetTickCount64() # 组合本地 stub + 所有依赖 stub + 本地 text → 完整 IR combined_ir: bytes = stdlib.malloc(COMBINED_IR_SIZE) if combined_ir is None: @@ -943,6 +945,8 @@ def RunMultiFileProject(mb: memhub.MemBuddy | t.CPtr, VLogger.error(fb, "PhaseB") stdlib.free(combined_ir) continue + # 计时点 1:BuildCombinedIR 完成 + t_pb1: t.CUInt64T = w32.win32base.GetTickCount64() # 写 .ll(llc 线程只读此文件);llc 本身改为循环后批量并行 ret_w: int = BuildPipeline.write_ir_to_file(combined_ir, combined_len, temp_dir, ent.Sha1) @@ -953,6 +957,8 @@ def RunMultiFileProject(mb: memhub.MemBuddy | t.CPtr, viperlib.snprintf(fb, 1024, "写 .ll 失败: %s", ent.Path) VLogger.error(fb, "PhaseB") sys.exit(1) + # 计时点 2:写 .ll 完成 + t_pb2: t.CUInt64T = w32.win32base.GetTickCount64() # 构造 llc 任务(命令串 stdlib.malloc,线程运行期不被 reset 回收) llc_ir_path: str = BuildPipeline.build_sliced_path(temp_dir, ent.Sha1, "ll") @@ -968,13 +974,17 @@ def RunMultiFileProject(mb: memhub.MemBuddy | t.CPtr, viperlib.snprintf(fb, 1024, "llc 任务构造失败: %s", ent.Path) VLogger.error(fb, "PhaseB") sys.exit(1) + # 计时点 3:llc 任务构造完成 + t_pb3: t.CUInt64T = w32.win32base.GetTickCount64() llc_task_count += 1 compiled_count += 1 - # 显示已提交 llc 的文件 + # 显示已提交 llc 的文件(含三步计时:合并 stub / 写 .ll / 构造任务) fb_comp: str = VLogger.fmt_buf() if fb_comp is not None: - viperlib.snprintf(fb_comp, 1024, "[%d/%d] llc 已提交: %s", i + 1, file_count, ent.Path) + viperlib.snprintf(fb_comp, 1024, "[%d/%d] llc 已提交: %s (merge=%llu ms, write=%llu ms, task=%llu ms, total=%llu ms)", + i + 1, file_count, ent.Path, + t_pb1 - t_pb0, t_pb2 - t_pb1, t_pb3 - t_pb2, t_pb3 - t_pb0) VLogger.info(fb_comp, "PhaseB") # 构造 .obj 路径,检测是否是 main 模块(test_main.vp/.py 或 main.vp/.py) od_len: t.CSizeT = string.strlen(output_dir)