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 ;
7 SYMBOL: last-dispatch-stats
9 : dispatch-stats. ( -- )
10 last-dispatch-stats get {
11 { "Megamorphic hits" [ megamorphic-cache-hits>> ] }
12 { "Megamorphic misses" [ megamorphic-cache-misses>> ] }
13 { "Cold to monomorphic" [ cold-call-to-ic-transitions>> ] }
14 { "Mono to polymorphic" [ ic-to-pic-transitions>> ] }
15 { "Poly to megamorphic" [ pic-to-mega-transitions>> ] }
16 { "Tag check count" [ pic-tag-count>> ] }
17 { "Tuple check count" [ pic-tuple-count>> ] }
20 : collect-dispatch-stats ( quot -- dispatch-statistics )
23 dispatch-stats dispatch-statistics memory>struct ; inline