main.v: print how much time cc() took; more flags explained

pull/1195/head
Alexander Medvednikov 2019-07-21 19:42:51 +02:00
parent 18d95114e0
commit e11c23a817
1 changed files with 12 additions and 4 deletions

View File

@ -643,12 +643,17 @@ mut args := ''
$if windows {
cmd = 'gcc $args'
}
// Run
ticks := time.ticks()
res := os.exec(cmd)
diff := time.ticks() - ticks
// Print the C command
if v.pref.show_c_cmd || v.pref.is_verbose {
println('\n==========\n$cmd\n=========\n')
println('\n==========')
println(cmd)
println('cc took $diff ms')
println('=========\n')
}
// Run
res := os.exec(cmd)
// println('C OUTPUT:')
if res.contains('error: ') {
println(res)
@ -1124,10 +1129,13 @@ Options:
-prod Build an optimized executable.
-o <file> Place output into <file>.
-obf Obfuscate the resulting binary.
-show_c_cmd Print the full C compilation command.
-show_c_cmd Print the full C compilation command and how much time it took.
-debug Leave a C file for debugging in .program.c.
-live Enable hot code reloading (required by functions marked with [live]).
fmt Run vfmt to format the source code.
run Build and execute a V program. You can add arguments after the file name.
Files:
<file>_test.v Test file.
'