From 6a2cf3516dd5548f888ae4d3afd1ba0c7978abea Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 19 Nov 2009 23:50:30 -0600 Subject: [PATCH] Bootstrap and mason now record times in nanoseconds --- basis/bootstrap/stage2.factor | 6 +++--- extra/benchmark/benchmark.factor | 2 +- extra/mason/common/common-tests.factor | 2 +- extra/mason/common/common.factor | 8 +++----- extra/mason/report/report.factor | 2 +- extra/mason/test/test.factor | 13 +++++-------- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index d3a4fb8ab4..98b6a472ed 100644 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -36,7 +36,7 @@ SYMBOL: bootstrap-time all-words swap count number>string write ; inline : print-time ( us -- ) - 1000 /i + 1,000,000,000 /i 60 /mod swap number>string write " minutes and " write number>string write " seconds." print ; @@ -84,14 +84,14 @@ SYMBOL: bootstrap-time load-components - nano-count over - 1000000 /i core-bootstrap-time set-global + nano-count over - core-bootstrap-time set-global run-bootstrap-init f error set-global f error-continuation set-global - nano-count swap - 1000000 /i bootstrap-time set-global + nano-count swap - bootstrap-time set-global print-report "deploy-vocab" get [ diff --git a/extra/benchmark/benchmark.factor b/extra/benchmark/benchmark.factor index 59251e4f02..ebffd4a17c 100755 --- a/extra/benchmark/benchmark.factor +++ b/extra/benchmark/benchmark.factor @@ -46,7 +46,7 @@ PRIVATE> [ [ [ [ 1array $vocab-link ] with-cell ] - [ 1000000000 /f pprint-cell ] + [ 1,000,000,000 /f pprint-cell ] bi* ] with-row ] assoc-each diff --git a/extra/mason/common/common-tests.factor b/extra/mason/common/common-tests.factor index 095cbd1a80..6d7f973296 100644 --- a/extra/mason/common/common-tests.factor +++ b/extra/mason/common/common-tests.factor @@ -2,7 +2,7 @@ IN: mason.common.tests USING: prettyprint mason.common mason.config namespaces calendar tools.test io.files io.files.temp io.encodings.utf8 ; -[ "00:01:01" ] [ 61000 milli-seconds>time ] unit-test +[ "00:01:02" ] [ 62,000,000,000 nanos>time ] unit-test [ "/home/bobby/builds/factor" ] [ [ diff --git a/extra/mason/common/common.factor b/extra/mason/common/common.factor index 71ac313ada..e77dacaf58 100755 --- a/extra/mason/common/common.factor +++ b/extra/mason/common/common.factor @@ -3,7 +3,7 @@ USING: kernel namespaces sequences splitting system accessors math.functions make io io.files io.pathnames io.directories io.directories.hierarchy io.launcher io.encodings.utf8 prettyprint -combinators.short-circuit parser combinators calendar +combinators.short-circuit parser combinators math calendar calendar.format arrays mason.config locals debugger fry continuations strings io.sockets ; IN: mason.common @@ -57,10 +57,8 @@ M: unix really-delete-tree delete-tree ; } cleave ] { } make [ pad-00 ] map "-" join ; -: milli-seconds>time ( n -- string ) - millis>timestamp - [ hour>> ] [ minute>> ] [ second>> floor ] tri 3array - [ pad-00 ] map ":" join ; +: nanos>time ( n -- string ) + 1,000,000,000 /i 60 /mod [ 60 /mod ] dip 3array [ pad-00 ] map ":" join ; SYMBOL: stamp diff --git a/extra/mason/report/report.factor b/extra/mason/report/report.factor index 4a2138323c..f75b5ffbb7 100644 --- a/extra/mason/report/report.factor +++ b/extra/mason/report/report.factor @@ -67,7 +67,7 @@ IN: mason.report benchmark-time-file html-help-time-file } [ - dup eval-file milli-seconds>time + dup eval-file nanos>time [XML <-><-> XML] ] map [XML

Timings

<->
XML] ; diff --git a/extra/mason/test/test.factor b/extra/mason/test/test.factor index 235c9adbc6..034d86b9c6 100644 --- a/extra/mason/test/test.factor +++ b/extra/mason/test/test.factor @@ -51,9 +51,6 @@ M: method-body word-vocabulary "method-generic" word-prop word-vocabulary ; compiler-error-messages-file do-step ; -: benchmark-ms ( quot -- ms ) - benchmark 1000000 /i ; inline - : check-boot-image ( -- ) "" to-refresh drop 2dup [ empty? not ] either? [ @@ -67,11 +64,11 @@ M: method-body word-vocabulary "method-generic" word-prop word-vocabulary ; ".." [ bootstrap-time get boot-time-file to-file check-boot-image - [ do-load ] benchmark-ms load-time-file to-file - [ generate-help ] benchmark-ms html-help-time-file to-file - [ do-tests ] benchmark-ms test-time-file to-file - [ do-help-lint ] benchmark-ms help-lint-time-file to-file - [ do-benchmarks ] benchmark-ms benchmark-time-file to-file + [ do-load ] benchmark load-time-file to-file + [ generate-help ] benchmark html-help-time-file to-file + [ do-tests ] benchmark test-time-file to-file + [ do-help-lint ] benchmark help-lint-time-file to-file + [ do-benchmarks ] benchmark benchmark-time-file to-file do-compile-errors ] with-directory ;