| 
									
										
										
										
											2010-03-15 21:00:15 -04:00
										 |  |  | ! Copyright (C) 2009, 2010 Slava Pestov. | 
					
						
							| 
									
										
										
										
											2009-11-05 02:36:26 -05:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | USING: accessors kernel namespaces prettyprint classes.struct | 
					
						
							|  |  |  | vm tools.dispatch.private ;
 | 
					
						
							|  |  |  | IN: tools.dispatch | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SYMBOL: last-dispatch-stats | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : dispatch-stats. ( -- )
 | 
					
						
							|  |  |  |     last-dispatch-stats get { | 
					
						
							|  |  |  |         { "Megamorphic hits" [ megamorphic-cache-hits>> ] } | 
					
						
							|  |  |  |         { "Megamorphic misses" [ megamorphic-cache-misses>> ] } | 
					
						
							|  |  |  |         { "Cold to monomorphic" [ cold-call-to-ic-transitions>> ] } | 
					
						
							|  |  |  |         { "Mono to polymorphic" [ ic-to-pic-transitions>> ] } | 
					
						
							|  |  |  |         { "Poly to megamorphic" [ pic-to-mega-transitions>> ] } | 
					
						
							|  |  |  |         { "Tag check count" [ pic-tag-count>> ] } | 
					
						
							|  |  |  |         { "Tuple check count" [ pic-tuple-count>> ] } | 
					
						
							|  |  |  |     } object-table. ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-15 23:44:36 -04:00
										 |  |  | : collect-dispatch-stats ( quot -- dispatch-statistics )
 | 
					
						
							| 
									
										
										
										
											2009-11-05 02:36:26 -05:00
										 |  |  |     reset-dispatch-stats | 
					
						
							|  |  |  |     call
 | 
					
						
							| 
									
										
										
										
											2010-03-15 21:00:15 -04:00
										 |  |  |     dispatch-stats dispatch-statistics memory>struct ; inline
 |