1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

new benchmark module + make the tests use it

This commit is contained in:
Delyan Angelov
2019-09-16 17:29:06 +03:00
committed by Alexander Medvednikov
parent 3325775944
commit a45895a3af
5 changed files with 148 additions and 46 deletions

View File

@@ -2,18 +2,23 @@ module main
import compiler.tests.repl.runner
import log
import benchmark
fn main(){
logger := &log.Log{log.DEBUG, 'terminal'}
options := runner.new_options()
global_start_time := runner.now()
mut bmark := benchmark.new_benchmark()
for file in options.files {
stime := runner.now()
bmark.step()
fres := runner.run_repl_file(options.wd, options.vexec, file) or {
logger.error( runner.tdiff_in_ms(err, stime) )
bmark.fail()
logger.error( bmark.step_message( err ) )
continue
}
logger.info( runner.tdiff_in_ms(fres, stime) )
bmark.ok()
logger.info( bmark.step_message( fres ) )
}
logger.info( runner.tdiff_in_ms('<=== total time spent running REPL files', global_start_time) )
bmark.stop()
logger.info( bmark.total_message('total time spent running REPL files') )
}