From 206e5aa6d34ac3fb32bdf9e6affc153547e189d8 Mon Sep 17 00:00:00 2001 From: bg Date: Thu, 14 May 2009 20:25:38 +0000 Subject: [PATCH] performance tool tuning --- Makefile | 18 +++++++++++++++++- avr-makefile.inc | 21 ++++++++++++--------- host/performance2wiki.rb | 9 +++++++-- mkfiles/ubi.mk | 2 +- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index f233faf..f51b1a7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # Makefile for the AVR-Crypto-Lib project # author: Daniel Otte +SHELL = sh BLOCK_CIPHERS := STREAM_CIPHERS := @@ -7,13 +8,14 @@ HASHES := MACS := PRNGS := ENCODINGS := +AUX := # we use the gnu make standard library include gmsl include avr-makefile.inc include mkfiles/*.mk -ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS) $(ENCODINGS) +ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS) $(ENCODINGS) $(AUX) ALGORITHMS_OBJ = $(patsubst %,%_OBJ, $(ALGORITHMS)) ALGORITHMS_TEST_BIN = $(patsubst %,%_TEST_BIN, $(ALGORITHMS)) @@ -201,6 +203,20 @@ $(foreach algo, $(ALGORITHMS),$(eval $(call TESTRUN_TEMPLATE, $(algo), $(call lc all_testrun: $(foreach algo, $(ALGORITHMS), $(algo)_TESTRUN) +#------------------------------------------------------------------------------- + +define TESTSPEED_TEMPLATE +$(1)_TESTSPEED: $(1)_FLASH + @echo "[speed]: $(1)" + $(RUBY) $(GET_PERFORMANCE) $(TESTPORT) $(TESTPORTBAUDR) 8 1 performance $(SPEEDLOG_DIR)$(SPEEDPREFIX) $(2) +endef + +$(foreach algo, $(ALGORITHMS),$(eval $(call TESTSPEED_TEMPLATE, $(algo), $(call lc,$(algo)) ))) + +all_testspeed: $(foreach algo, $(ALGORITHMS), $(algo)_TESTSPEED) +hash_testspeed: $(foreach algo, $(HASHES), $(algo)_TESTSPEED) + + #------------------------------------------------------------------------------- define LISTING_TEMPLATE diff --git a/avr-makefile.inc b/avr-makefile.inc index ee46746..d44ca11 100644 --- a/avr-makefile.inc +++ b/avr-makefile.inc @@ -15,6 +15,8 @@ TESTPORT = /dev/ttyUSB1 TESTPORTBAUDR = 38400 TESTLOG_DIR = testlog/ TESTPREFIX = nessie- +SPEEDLOG_DIR = speed_log/ +SPEEDPREFIX = LIST_DIR = listings/ STAT_DIR = stats/ AUTOASM_DIR = autoasm/ @@ -29,12 +31,13 @@ override ASFLAGS = -mmcu=$(MCU_TARGET) -Wa,--gdwarf-2 SIZESTAT_FILE = sizestats.txt -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -READELF = readelf -RUBY = ruby -GET_TEST = host/get_test.rb -MAKE = make -MAKE2GRAPH = ~/bin/make2graph.rb -TWOPI = twopi +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +READELF = readelf +RUBY = ruby +GET_TEST = host/get_test.rb +GET_PERFORMANCE = host/get_performance.rb +MAKE = make +MAKE2GRAPH = ~/bin/make2graph.rb +TWOPI = twopi diff --git a/host/performance2wiki.rb b/host/performance2wiki.rb index 9d46dd3..29afa46 100644 --- a/host/performance2wiki.rb +++ b/host/performance2wiki.rb @@ -57,8 +57,11 @@ def process_hashfunction(fin, name) m = lb.match(/ctx2hash \(cycles\):[\s]*([\d]*)/) convtime = m[1].to_i() - printf("| %s || C || C || || %4d || %4d || %4d || %6d || %6d || %6.2f || %6d || || || \n|-\n" , - name, ctxsize, hashsize, blocksize, inittime, nextblocktime, nextblocktime.to_f/blocksize*8, lastblocktime+convtime) + printf("| %20s || %3s || %3s || || %4d || %4d || %4d ||" + + " %6d || %6d || %7.2f || %6d || || || \n|-\n" , + name, $lang, $lang ,ctxsize, hashsize, blocksize, + inittime, nextblocktime, nextblocktime.to_f/blocksize*8, + lastblocktime+convtime) end @@ -68,6 +71,8 @@ $handlers["hashfunction"] = 1 #process_hashfunction def process_file(fname) fin = File.open(fname, "r") + $lang = "asm" + $lang = "C" if fname.match(/_c.txt$/) begin begin if fin.eof() diff --git a/mkfiles/ubi.mk b/mkfiles/ubi.mk index b366608..9f0984d 100644 --- a/mkfiles/ubi.mk +++ b/mkfiles/ubi.mk @@ -2,7 +2,7 @@ ALGO_NAME := UBI # comment out the following line for removement of ubi from the build process -HASHES += $(ALGO_NAME) +AUX += $(ALGO_NAME) $(ALGO_NAME)_OBJ := threefish_mix.o threefish256_enc_asm.o ubi256_asm.o \