More compile timers, euler3

This commit is contained in:
Krzosa Karol
2022-06-08 10:04:34 +02:00
parent 87d6737a10
commit 19356026fe
3 changed files with 18 additions and 10 deletions

View File

@@ -187,14 +187,19 @@ int main(int argument_count, char **arguments){
Scratch scratch;
String name = string_fmt(scratch, "%s.kl", arguments[1]);
String c_filename = string_fmt(scratch, "%s.c", arguments[1]);
String call = string_fmt(scratch, "clang.exe %s.c -g -o %s.exe && %s.exe", arguments[1], arguments[1], arguments[1]);
String compiler_call = string_fmt(scratch, "clang.exe %s.c -g -o %s.exe", arguments[1], arguments[1]);
String run_program = string_fmt(scratch, "%s.exe", arguments[1]);
String result = compile_file(name);
FILE *f = fopen((const char *)c_filename.str, "w");
assert(f);
fprintf(f, "%.*s", (int)result.len, result.str);
fclose(f);
system((const char *)call.str);
F64 begin = os_time();
system((const char *)compiler_call.str);
printf("\nCompile time: %f", os_time() - begin);
system((const char *)run_program.str);
}
else{
String result = {};