Changeset 177 for trunk/thune/scripts

Show
Ignore:
Timestamp:
06/09/06 04:19:52 (3 years ago)
Author:
krobillard
Message:

Thune - opcode_ratio.t improved.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/scripts/opcode_ratio.t

    r176 r177  
    1 ; Calculates ratio of opcode to non-opcode values in files. 
     1; Calculates ratio of stack opcodes to total values in files. 
    22 
    330 :total 
    440 :ops 
     50 :words 
    560 :files 
    67 
     8[drop dup dup2 over swap nip tuck rot rot.r] :stack-ops 
     9 
    710[ 
    8     dup length? inc total add :total  
     11    dup length? total add :total  
    912    [ 
    1013        first dup type?.word [ 
    1114            block!  [calc-ratio] 
    1215            paren!  [calc-ratio] 
    13             opcode! [drop ops inc :ops] 
     16            word!   [drop words inc :words] 
     17            opcode! [stack-ops swap find dup 
     18                     ift (ops inc :ops) 
     19                     iff (words inc :words) 
     20                    ] 
    1421            [drop] 
    1522        ] case 
    16     ] iter     
     23    ] iter 
    1724] 
    1825proc :calc-ratio  ; (block -- ) 
     
    2431 
    2532[ 
    26       "Files:        " files 
    27     "^/Total values: " total 
    28     "^/Opcodes:      " ops 
    29     "^/Ratio:        " (ops total decimal! as div) 
     33      "Files:         " files 
     34    "^/Total values:  " total 
     35    "^/Word values:   " words 
     36    "^/Stack opcodes: " ops 
     37    "^/Ops/Values:    " (ops total decimal! as div) 
     38    "^/Ops/Words:     " (ops words decimal! as div) 
    3039    eol 
    3140]