mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Correct format strings
This commit is contained in:
@@ -186,9 +186,32 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
|
|||||||
lb_init_module(pm, do_threading);
|
lb_init_module(pm, do_threading);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkg->kind == Package_Runtime) {
|
bool allow_for_per_file = pkg->kind == Package_Runtime || module_per_file;
|
||||||
// allow this to be per file
|
|
||||||
} else if (!module_per_file) {
|
#if 0
|
||||||
|
if (!allow_for_per_file) {
|
||||||
|
if (pkg->files.count >= 20) {
|
||||||
|
isize proc_count = 0;
|
||||||
|
for (Entity *e : gen->info->entities) {
|
||||||
|
if (e->kind != Entity_Procedure) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (e->Procedure.is_foreign) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (e->pkg == pkg) {
|
||||||
|
proc_count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proc_count >= 300) {
|
||||||
|
allow_for_per_file = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!allow_for_per_file) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// NOTE(bill): Probably per file is not a good idea, so leave this for later
|
// NOTE(bill): Probably per file is not a good idea, so leave this for later
|
||||||
|
|||||||
@@ -2897,7 +2897,7 @@ gb_internal void lb_do_para_poly_diagnostics(lbGenerator *gen) {
|
|||||||
|
|
||||||
f64 average = cast(f64)code_size / cast(f64)gb_max(count, 1);
|
f64 average = cast(f64)code_size / cast(f64)gb_max(count, 1);
|
||||||
|
|
||||||
gb_printf("%23td | %19d | %25.2f | %.*s\n", code_size, count, average, LIT(name));
|
gb_printf("%23td | %19td | %25.2f | %.*s\n", code_size, count, average, LIT(name));
|
||||||
if (max_count-- <= 0) {
|
if (max_count-- <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2930,7 +2930,7 @@ gb_internal void lb_do_para_poly_diagnostics(lbGenerator *gen) {
|
|||||||
|
|
||||||
f64 average = cast(f64)code_size / cast(f64)gb_max(count, 1);
|
f64 average = cast(f64)code_size / cast(f64)gb_max(count, 1);
|
||||||
|
|
||||||
gb_printf("%19d | %23td | %25.2f | %.*s\n", count, code_size, average, LIT(name));
|
gb_printf("%19td | %23td | %25.2f | %.*s\n", count, code_size, average, LIT(name));
|
||||||
if (max_count-- <= 0) {
|
if (max_count-- <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2989,8 +2989,8 @@ gb_internal void lb_do_module_diagnostics(lbGenerator *gen) {
|
|||||||
array_init(&modules, heap_allocator());
|
array_init(&modules, heap_allocator());
|
||||||
defer (array_free(&modules));
|
defer (array_free(&modules));
|
||||||
|
|
||||||
for (auto &entry : gen->modules) {
|
for (auto &em : gen->modules) {
|
||||||
lbModule *m = entry.value;
|
lbModule *m = em.value;
|
||||||
|
|
||||||
{
|
{
|
||||||
lbDiagModuleEntry entry = {};
|
lbDiagModuleEntry entry = {};
|
||||||
@@ -3040,14 +3040,28 @@ gb_internal void lb_do_module_diagnostics(lbGenerator *gen) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gb_printf("Module Diagnostics\n\n");
|
gb_printf("Module Diagnostics\n\n");
|
||||||
gb_printf("Total Instructions | Global Internals | Global Externals | Proc Internals | Proc Externals | Module Name\n");
|
gb_printf("Total Instructions | Global Internals | Global Externals | Proc Internals | Proc Externals | Files | Instructions/File | Instructions/Proc | Module Name\n");
|
||||||
|
gb_printf("-------------------+------------------+------------------+----------------+----------------+-------+-------------------+-------------------+------------\n");
|
||||||
for (auto &entry : modules) {
|
for (auto &entry : modules) {
|
||||||
gb_printf("%18td | %16td | %16td | %14td | %14d | %s \n",
|
isize file_count = 1;
|
||||||
|
if (entry.m->file != nullptr) {
|
||||||
|
file_count = 1;
|
||||||
|
} else if (entry.m->pkg) {
|
||||||
|
file_count = entry.m->pkg->files.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
f64 instructions_per_file = cast(f64)entry.total_instruction_count / gb_max(1.0, cast(f64)file_count);
|
||||||
|
f64 instructions_per_proc = cast(f64)entry.total_instruction_count / gb_max(1.0, cast(f64)entry.proc_internal_count);
|
||||||
|
|
||||||
|
gb_printf("%18td | %16td | %16td | %14td | %14td | %5td | %17.1f | %17.1f | %s \n",
|
||||||
entry.total_instruction_count,
|
entry.total_instruction_count,
|
||||||
entry.global_internal_count,
|
entry.global_internal_count,
|
||||||
entry.global_external_count,
|
entry.global_external_count,
|
||||||
entry.proc_internal_count,
|
entry.proc_internal_count,
|
||||||
entry.proc_external_count,
|
entry.proc_external_count,
|
||||||
|
file_count,
|
||||||
|
instructions_per_file,
|
||||||
|
instructions_per_proc,
|
||||||
entry.m->module_name);
|
entry.m->module_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user