db4
Slava Pestov 2008-05-07 21:54:41 -05:00
parent b8e691297d
commit 1cbe87da82
3 changed files with 16 additions and 19 deletions

View File

@ -36,6 +36,7 @@ IN: tools.memory
[ first2 ] [ number>string "Generation " prepend ] bi*
write-total/used/free
] 2each
"Decks" write-total
"Cards" write-total ;
: write-labelled-size ( n string -- )

View File

@ -20,14 +20,6 @@ HELP: benchmark
HELP: time
{ $values { "quot" "a quotation" } }
{ $description "Runs a quotation and then prints the total run time and time spent in the garbage collector." }
{ $examples
"This word can be used to compare performance of the non-optimizing and optimizing compilers."
$nl
"First, we time a quotation directly; quotations are compiled by the non-optimizing quotation compiler:"
{ $unchecked-example "[ 1000000 0 [ + ] reduce drop ] time" "1116 ms run / 6 ms GC time" }
"Now we define a word and compile it with the optimizing word compiler. This results is faster execution:"
{ $unchecked-example ": foo 1000000 0 [ + ] reduce ;" "\\ foo compile" "[ foo drop ] time" "202 ms run / 13 ms GC time" }
} ;
{ $description "Runs a quotation and then prints the total run time and some garbage collection statistics." } ;
{ gc-time benchmark millis time } related-words
{ benchmark millis time } related-words

View File

@ -9,15 +9,19 @@ IN: tools.time
: stats. ( data -- )
{
"Run time"
"GC time"
"Nursery collections"
"Aging collections"
"Tenured collections"
"Cards checked"
"Cards scanned"
"Code literal collections"
} swap zip [ nip 0 > ] assoc-filter
"Run time (ms):"
"Nursery GC time (ms):"
"Nursery GC #:"
"Aging GC time (ms):"
"Aging GC #:"
"Tenured GC time (ms):"
"Tenured GC #:"
"Cards scanned:"
"Decks scanned:"
"Code literal GC #:"
"Bytes copied:"
"Bytes collected:"
} swap zip
standard-table-style [
[
[