compiler/PPCProfilingContext.st
changeset 464 f6d77fee9811
parent 459 4751c407bb40
child 502 1e45d3c96ec5
equal deleted inserted replaced
459:4751c407bb40 464:f6d77fee9811
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
     2 
     2 
     3 "{ NameSpace: Smalltalk }"
     3 "{ NameSpace: Smalltalk }"
     4 
     4 
     5 PPCContext subclass:#PPCProfilingContext
     5 PPCContext subclass:#PPCProfilingContext
     6 	instanceVariableNames:'invocations remembers restores lwRemembers lwRestores totalSize'
     6 	instanceVariableNames:'invocations remembers restores lwRemembers lwRestores totalSize
       
     7 		tokenReads'
     7 	classVariableNames:''
     8 	classVariableNames:''
     8 	poolDictionaries:''
     9 	poolDictionaries:''
     9 	category:'PetitCompiler-Context'
    10 	category:'PetitCompiler-Context'
    10 !
    11 !
    11 
    12 
    33     remembers := OrderedCollection new.
    34     remembers := OrderedCollection new.
    34     restores := OrderedCollection new.
    35     restores := OrderedCollection new.
    35     
    36     
    36     lwRemembers := OrderedCollection new.
    37     lwRemembers := OrderedCollection new.
    37     lwRestores := OrderedCollection new.
    38     lwRestores := OrderedCollection new.
       
    39     
       
    40     tokenReads := OrderedCollection new.
    38     
    41     
    39     totalSize := 0.
    42     totalSize := 0.
    40 ! !
    43 ! !
    41 
    44 
    42 !PPCProfilingContext methodsFor:'profiling'!
    45 !PPCProfilingContext methodsFor:'profiling'!
    99 !
   102 !
   100 
   103 
   101 stream: aStream
   104 stream: aStream
   102     totalSize := totalSize + aStream size.
   105     totalSize := totalSize + aStream size.
   103     ^ super stream: aStream
   106     ^ super stream: aStream
       
   107 !
       
   108 
       
   109 tokenRead: tokenName
       
   110     tokenReads add: tokenName
       
   111 !
       
   112 
       
   113 tokenReadCount
       
   114     ^ tokenReads size
       
   115 !
       
   116 
       
   117 tokenReads
       
   118     ^ tokenReads 
   104 ! !
   119 ! !
   105 
   120 
   106 !PPCProfilingContext methodsFor:'reporting'!
   121 !PPCProfilingContext methodsFor:'reporting'!
   107 
   122 
   108 asReportTable
   123 asReportTable
   114         #'invocation count' -> self invocationCount.
   129         #'invocation count' -> self invocationCount.
   115         #'lwRemember count' -> self lwRememberCount.
   130         #'lwRemember count' -> self lwRememberCount.
   116         #'lwRestore count' -> self lwRestoreCount.
   131         #'lwRestore count' -> self lwRestoreCount.
   117         #'remember count' -> self rememberCount.
   132         #'remember count' -> self rememberCount.
   118         #'restore count' -> self restoreCount.
   133         #'restore count' -> self restoreCount.
       
   134         #'token read count' -> self tokenReadCount.
   119     
   135     
   120     }
   136     }
   121 !
   137 !
   122 
   138 
   123 invocationCount
   139 invocationCount