Changeset 177 for trunk/thune/scripts
- Timestamp:
- 06/09/06 04:19:52 (3 years ago)
- Files:
-
- 1 modified
-
trunk/thune/scripts/opcode_ratio.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/scripts/opcode_ratio.t
r176 r177 1 ; Calculates ratio of opcode to non-opcodevalues in files.1 ; Calculates ratio of stack opcodes to total values in files. 2 2 3 3 0 :total 4 4 0 :ops 5 0 :words 5 6 0 :files 6 7 8 [drop dup dup2 over swap nip tuck rot rot.r] :stack-ops 9 7 10 [ 8 dup length? inctotal add :total11 dup length? total add :total 9 12 [ 10 13 first dup type?.word [ 11 14 block! [calc-ratio] 12 15 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 ] 14 21 [drop] 15 22 ] case 16 ] iter 23 ] iter 17 24 ] 18 25 proc :calc-ratio ; (block -- ) … … 24 31 25 32 [ 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) 30 39 eol 31 40 ]
