5 This file is part of the AVR-Crypto-Lib.
6 Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 === Twister-256 performance ===
29 nextBlock (cycles): 36535
30 lastBlock (cycles): 8071
31 ctx2hash (cycles): 19431
33 text data bss dec hex filename
34 6801 32 0 6833 1ab1 bin/bmw_c/bmw_small.o
37 def get_size_string(impl, algo)
38 fmap = File.open('algo_implementation/'+impl+'.algos', 'r')
39 fsize = File.open('size_log/'+impl+'.size', 'r')
42 if m=l.match(/^([^:]*):(.*)$/)
44 modules = m[2].split(' ')
49 puts("ERROR: no module list found for #{impl}/#{algo} !")
56 while lb = fsize.gets()
57 m = lb.match(/[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w]*)[\s]*([\w_\/-]*)/)
59 if modules.include?(name)
60 str += "<br> \n" + name+': '+m[4]
68 def process_hashfunction(fin, name, impl)
70 m = lb.match(/hashsize \(bits\):[\s]*([\d]*)/)
72 printf("unexpected string %s\n", lb)
74 hashsize = m[1].to_i()
76 m = lb.match(/ctxsize \(bytes\):[\s]*([\d]*)/)
79 m = lb.match(/blocksize \(bits\):[\s]*([\d]*)/)
80 blocksize = m[1].to_i()
82 m = lb.match(/init \(cycles\):[\s]*([\d]*)/)
83 inittime = m[1].to_i()
85 m = lb.match(/nextBlock \(cycles\):[\s]*([\d]*)/)
86 nextblocktime = m[1].to_i()
88 m = lb.match(/lastBlock \(cycles\):[\s]*([\d]*)/)
89 lastblocktime = m[1].to_i()
91 m = lb.match(/ctx2hash \(cycles\):[\s]*([\d]*)/)
92 convtime = m[1].to_i()
95 end until m = lb.match(/init \(bytes\):[\s]*([\d]*)/)
96 initstack = m[1].to_i()
98 m = lb.match(/nextBlock \(bytes\):[\s]*([\d]*)/)
99 nextblockstack = m[1].to_i()
101 m = lb.match(/lastBlock \(bytes\):[\s]*([\d]*)/)
102 lastblockstack = m[1].to_i()
104 m = lb.match(/ctx2hash \(bytes\):[\s]*([\d]*)/)
105 convstack = m[1].to_i()
106 s1 = (initstack>nextblockstack)?initstack:nextblockstack
107 s2 = (lastblockstack>convstack)?lastblockstack:convstack
108 stack = (s1>s2)?s1:s2
109 size = get_size_string(impl, name)
110 printf("| %20s || %3s || %3s || %6d || %7d || %7d || %7d || %7d ||" +
111 " %7d || %7d || %9.2f || %7d || || || \n|-\n" ,
112 name, $lang, $lang, size, ctxsize, stack, hashsize, blocksize,
113 inittime, nextblocktime, nextblocktime.to_f/(blocksize/8),
114 lastblocktime+convtime)
119 $handlers.default = 0
120 $handlers["hashfunction"] = 1 #process_hashfunction
122 def process_file(fname)
123 fin = File.open(fname, "r")
125 $lang = "C" if fname.match(/_c.txt$/)
126 impl = fname.match(/([^.]*).txt$/)[1]
133 end while !m=lb.match(/=== (.*) performance ===/)
136 m = lb.match(/type:[\s]*([\w]*)/)
138 if $handlers[type] != 0
139 # handlers[type](fin, name)
140 process_hashfunction(fin, name, impl)
142 printf("ERROR: unsupported type: %s !\n", type)
148 for i in (0..ARGV.size-1)
149 process_file(ARGV[i])