From e0050af293146a38e2122413196e66f73d90f2e0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 25 Apr 2017 12:29:25 -0400 Subject: add some timing diagnostics pass --enable-timing-info to print a nice table like this: ``` Name Start End Duration Percent Initialize 0.0000 0.0000 0.0000 0.0001 Semantic Analysis 0.0000 0.0421 0.0420 0.2109 Code Generation 0.0421 0.0620 0.0200 0.1003 LLVM Emit Object 0.0620 0.1852 0.1231 0.6180 Build Dependencies 0.1852 0.1974 0.0122 0.0615 LLVM Link 0.1974 0.1993 0.0018 0.0093 Generate .h 0.1993 0.1993 0.0000 0.0000 Total 0.0000 0.1993 0.1993 1.0000 ``` --- src/link.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/link.cpp') diff --git a/src/link.cpp b/src/link.cpp index 5c73c2134e..59aa19e5db 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -732,6 +732,8 @@ static void construct_linker_job(LinkJob *lj) { } void codegen_link(CodeGen *g, const char *out_file) { + codegen_add_time_event(g, "Build Dependencies"); + LinkJob lj = {0}; // even though we're calling LLD as a library it thinks the first @@ -808,10 +810,12 @@ void codegen_link(CodeGen *g, const char *out_file) { Buf diag = BUF_INIT; + codegen_add_time_event(g, "LLVM Link"); if (!ZigLLDLink(g->zig_target.oformat, lj.args.items, lj.args.length, &diag)) { fprintf(stderr, "%s\n", buf_ptr(&diag)); exit(1); } + codegen_add_time_event(g, "Generate .h"); if (g->out_type == OutTypeLib || g->out_type == OutTypeObj) @@ -819,6 +823,8 @@ void codegen_link(CodeGen *g, const char *out_file) { codegen_generate_h_file(g); } + codegen_add_time_event(g, "Done"); + if (g->verbose) { fprintf(stderr, "OK\n"); } -- cgit v1.2.3