Expose time stats
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
CORE_Static void
|
||||
core_init_compiler(Core_Ctx *ctx, Allocator *allocator) {
|
||||
ctx->init_ctx_time_begin = os_time();
|
||||
ctx->time.init_context = os_time();
|
||||
pctx = ctx;
|
||||
|
||||
ctx->emit_type_info = true;
|
||||
@@ -155,7 +155,7 @@ pctx->op_info_table[19] = {pctx->intern("!"_s), "NOT"_s, TK_Not, 0, 1};
|
||||
|
||||
String main_module = string_fmt(ctx->perm, "%Q/modules", ctx->exe_folder);
|
||||
add(ctx->perm, &ctx->module_folders, main_module);
|
||||
ctx->init_ctx_time_end = os_time();
|
||||
ctx->time.init_context = os_time() - ctx->time.init_context;
|
||||
}
|
||||
|
||||
CORE_Static void
|
||||
@@ -177,7 +177,7 @@ insert_builtin_type_into_scope(Ast_Scope *p, String name, Ast_Type *type) {
|
||||
|
||||
CORE_Static void
|
||||
parse_all_modules() {
|
||||
pctx->parsing_time_begin = os_time();
|
||||
pctx->time.parsing = os_time();
|
||||
|
||||
For_Named(pctx->modules, module) {
|
||||
if (module->state != MODULE_REGISTERED)
|
||||
@@ -194,7 +194,7 @@ parse_all_modules() {
|
||||
|
||||
module->state = MODULE_PARSED;
|
||||
}
|
||||
pctx->parsing_time_end = os_time();
|
||||
pctx->time.parsing = os_time() - pctx->time.parsing;
|
||||
}
|
||||
|
||||
CORE_Static Ast_Module *
|
||||
@@ -260,7 +260,7 @@ CORE_Static void
|
||||
resolve_everything_in_module(Ast_Module *module) {
|
||||
if (module->state == MODULE_RESOLVED)
|
||||
return;
|
||||
pctx->resolving_time_begin = os_time();
|
||||
pctx->time.typechecking = os_time();
|
||||
For_Named(module->all_loaded_files, file) {
|
||||
For_Named(file->decls, decl) {
|
||||
resolve_name(file, decl->pos, decl->name);
|
||||
@@ -271,14 +271,15 @@ resolve_everything_in_module(Ast_Module *module) {
|
||||
}
|
||||
}
|
||||
module->state = MODULE_RESOLVED;
|
||||
pctx->resolving_time_end = os_time();
|
||||
pctx->time.typechecking = os_time() - pctx->time.typechecking;
|
||||
}
|
||||
|
||||
CORE_Static String
|
||||
compile_file_to_string(Allocator *allocator, String filename) {
|
||||
F64 total_time = os_time();
|
||||
core_bootstrap_compiler(allocator);
|
||||
pctx->total_time = total_time;
|
||||
pctx->time.total = total_time;
|
||||
pctx->time.start = total_time;
|
||||
{
|
||||
Ast_Module *module = add_module(0, pctx->intern("Language.core"_s));
|
||||
{
|
||||
@@ -343,5 +344,7 @@ compile_file_to_string(Allocator *allocator, String filename) {
|
||||
|
||||
pctx->stage_arena->len = 0;
|
||||
String result = compile_to_c_code();
|
||||
|
||||
pctx->time.total = os_time() - pctx->time.total;
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user