diff --git a/basis/tools/time/time-docs.factor b/basis/tools/time/time-docs.factor index 408592d0c6..3f8cbbf799 100644 --- a/basis/tools/time/time-docs.factor +++ b/basis/tools/time/time-docs.factor @@ -6,12 +6,9 @@ ARTICLE: "timing" "Timing code" { $subsections time } "A lower-level word puts timings on the stack, intead of printing:" { $subsections benchmark } -"You can also read the system clock and garbage collection statistics directly:" -{ $subsections - micros - gc-stats -} -{ $see-also "profiling" } ; +"You can also read the system clock directly:" +{ $subsections micros } +{ $see-also "profiling" "calendar" } ; ABOUT: "timing" @@ -23,6 +20,6 @@ HELP: benchmark HELP: time { $values { "quot" "a quotation" } } -{ $description "Runs a quotation and then prints the total run time and some garbage collection statistics." } ; +{ $description "Runs a quotation and then prints the total run time and some statistics." } ; { benchmark micros time } related-words diff --git a/basis/tools/time/time.factor b/basis/tools/time/time.factor index 948c0d482d..3d0509e87d 100644 --- a/basis/tools/time/time.factor +++ b/basis/tools/time/time.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2003, 2008 Slava Pestov. +! Copyright (C) 2003, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math memory io io.styles prettyprint namespaces system sequences splitting grouping assocs strings @@ -11,64 +11,28 @@ IN: tools.time : time. ( time -- ) "== Running time ==" print nl 1000000 /f pprint " seconds" print ; -: gc-stats. ( stats -- ) - 5 cut* - "== Garbage collection ==" print nl - "Times are in microseconds." print nl - [ - 6 group - { - "GC count:" - "Total GC time:" - "Longest GC pause:" - "Average GC pause:" - "Objects copied:" - "Bytes copied:" - } prefix - flip - { "" "Nursery" "Aging" "Tenured" } prefix - simple-table. - ] - [ - nl - { - "Total GC time:" - "Cards scanned:" - "Decks scanned:" - "Card scan time:" - "Code heap literal scans:" - } swap zip simple-table. - ] bi* ; - : dispatch-stats. ( stats -- ) "== Megamorphic caches ==" print nl { "Hits" "Misses" } swap zip simple-table. ; : inline-cache-stats. ( stats -- ) - nl "== Polymorphic inline caches ==" print nl + "== Polymorphic inline caches ==" print nl 3 cut [ - "Transitions:" print + "- Transitions:" print { "Cold to monomorphic" "Mono to polymorphic" "Poly to megamorphic" } swap zip simple-table. nl ] [ - "Type check stubs:" print + "- Type check stubs:" print { "Tag only" "Hi-tag" "Tuple" "Hi-tag and tuple" } swap zip simple-table. ] bi* ; : time ( quot -- ) - gc-reset reset-dispatch-stats reset-inline-cache-stats - benchmark gc-stats dispatch-stats inline-cache-stats - H{ { table-gap { 20 20 } } } [ - [ - [ [ time. ] 3dip ] with-cell - [ ] with-cell - ] with-row - [ - [ [ gc-stats. ] 2dip ] with-cell - [ [ dispatch-stats. ] [ inline-cache-stats. ] bi* ] with-cell - ] with-row - ] tabular-output nl ; inline + benchmark dispatch-stats inline-cache-stats + [ time. nl ] + [ dispatch-stats. nl ] + [ inline-cache-stats. ] + tri* ; inline