X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=performance_test.c;h=04a26bd0f34154404fe0efb42d900ca9880d2322;hb=f6e331f76599dbb9b3bb82fb9600bbc4410b77bb;hp=0728827cf75a9f085c5b8c708901074fba9181ba;hpb=9e7453525f32441ea49ef1d9b3248e94d9554eec;p=avr-crypto-lib.git diff --git a/performance_test.c b/performance_test.c index 0728827..04a26bd 100644 --- a/performance_test.c +++ b/performance_test.c @@ -1,3 +1,21 @@ +/* performance_test.c */ +/* + This file is part of the Crypto-avr-lib/microcrypt-lib. + Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ /* * author: Daniel Otte * email: daniel.otte@rub.de @@ -7,10 +25,13 @@ **/ #include "config.h" +#include #include #include #include #include +#include +#include "uart.h" #include "performance_test.h" @@ -65,6 +86,27 @@ void getOverhead(uint16_t* constoh, uint16_t* intoh){ *intoh = int_overhead; } +void print_time_P(PGM_P s, uint64_t t){ + char sv[16]; + uint8_t c; + uart_putstr_P(PSTR("\r\n")); + uart_putstr_P(s); + ultoa((unsigned long)t, sv, 10); + for(c=strlen(sv); c<11; ++c){ + uart_putc(' '); + } + uart_putstr(sv); +} +void print_overhead(void){ + char str[16]; + uart_putstr_P(PSTR("\r\n\r\n=== benchmark ===")); + utoa(const_overhead, str, 10); + uart_putstr_P(PSTR("\r\n\tconst overhead: ")); + uart_putstr(str); + utoa(int_overhead, str, 10); + uart_putstr_P(PSTR("\r\n\tinterrupt overhead: ")); + uart_putstr(str); +}