summaryrefslogtreecommitdiff
path: root/openpicc
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-03-17 19:42:19 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-03-17 19:42:19 +0000
commit48e2172698435156557d893cdc612b48f05bdf95 (patch)
tree838d929b86d4107ce2430f24675a07030a0d1cf8 /openpicc
parenta2f88381cc20a807393c4fc70732fb58e28ef3ae (diff)
Add performance measurement tools
git-svn-id: https://svn.openpcd.org:2342/trunk@460 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc')
-rw-r--r--openpicc/application/iso14443a_diffmiller.c21
-rw-r--r--openpicc/application/iso14443a_diffmiller.h2
2 files changed, 23 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;
+}
diff --git a/openpicc/application/iso14443a_diffmiller.h b/openpicc/application/iso14443a_diffmiller.h
index 7dc9c55..c657f1b 100644
--- a/openpicc/application/iso14443a_diffmiller.h
+++ b/openpicc/application/iso14443a_diffmiller.h
@@ -11,4 +11,6 @@ extern int iso14443a_diffmiller_assert_frame_ended(struct diffmiller_state * con
iso14443_frame * const frame);
extern struct diffmiller_state *iso14443a_init_diffmiller(int pauses_count);
+extern void iso14443a_diffmiller_print_performance(struct diffmiller_state * const state);
+
#endif /*ISO14443A_DIFFMILLER_H_*/
personal git repositories of Harald Welte. Your mileage may vary