diff options
author | henryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2008-03-17 19:42:19 +0000 |
---|---|---|
committer | henryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2008-03-17 19:42:19 +0000 |
commit | 48e2172698435156557d893cdc612b48f05bdf95 (patch) | |
tree | 838d929b86d4107ce2430f24675a07030a0d1cf8 /openpicc/application/iso14443a_diffmiller.c | |
parent | a2f88381cc20a807393c4fc70732fb58e28ef3ae (diff) |
Add performance measurement tools
git-svn-id: https://svn.openpcd.org:2342/trunk@460 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/iso14443a_diffmiller.c')
-rw-r--r-- | openpicc/application/iso14443a_diffmiller.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/openpicc/application/iso14443a_diffmiller.c b/openpicc/application/iso14443a_diffmiller.c index 97017f7..0c00107 100644 --- a/openpicc/application/iso14443a_diffmiller.c +++ b/openpicc/application/iso14443a_diffmiller.c @@ -93,6 +93,7 @@ enum symbol {NO_SYM=0, sym_x, sym_y, sym_z}; enum bit { BIT_ERROR, BIT_SOF, BIT_0, BIT_1, BIT_EOF }; +#define PERFORMANCE_COUNTS 10 struct diffmiller_state { int initialized, pauses_count; enum symbol old_state; @@ -102,6 +103,8 @@ struct diffmiller_state { u_int16_t byte,crc; u_int8_t parity; u_int8_t last_data_bit; + u_int32_t performance[PERFORMANCE_COUNTS][2]; + size_t perf_index; struct { u_int8_t in_frame:1; u_int8_t frame_finished:1; @@ -265,6 +268,11 @@ int iso14443a_decode_diffmiller(struct diffmiller_state * const state, iso14443_ int counter = state->counter; int last_data_bit = state->last_data_bit; + if(state->perf_index < PERFORMANCE_COUNTS) { + state->performance[state->perf_index][0] = *offset; + state->performance[state->perf_index++][1] = buflen; + } + for(; *offset < buflen; ) { int delta; if(state->pauses_count) @@ -377,3 +385,16 @@ struct diffmiller_state *iso14443a_init_diffmiller(int pauses_count) return state; } + + +#include "cmd.h" +void iso14443a_diffmiller_print_performance(struct diffmiller_state * const state) +{ + DumpStringToUSB("`"); + unsigned int i; for(i=0; i<state->perf_index; i++) { + if(i>0)DumpStringToUSB(";"); + DumpUIntToUSB(state->performance[i][0]); DumpStringToUSB(":"); DumpUIntToUSB(state->performance[i][1]); + } + DumpStringToUSB("'"); + state->perf_index=0; +} |