1 ! Copyright (C) 2009, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel namespaces prettyprint classes.struct
4 vm tools.dispatch.private ;
8 PRIMITIVE: dispatch-stats ( -- stats )
9 PRIMITIVE: reset-dispatch-stats ( -- )
12 SYMBOL: last-dispatch-stats
14 : dispatch-stats. ( -- )
15 last-dispatch-stats get {
16 { "Megamorphic hits" [ megamorphic-cache-hits>> ] }
17 { "Megamorphic misses" [ megamorphic-cache-misses>> ] }
18 { "Cold to monomorphic" [ cold-call-to-ic-transitions>> ] }
19 { "Mono to polymorphic" [ ic-to-pic-transitions>> ] }
20 { "Poly to megamorphic" [ pic-to-mega-transitions>> ] }
21 { "Tag check count" [ pic-tag-count>> ] }
22 { "Tuple check count" [ pic-tuple-count>> ] }
25 : collect-dispatch-stats ( quot -- dispatch-statistics )
28 dispatch-stats dispatch-statistics memory>struct ; inline