From 8a27889d505b07d91ecd03ad1cfeb818b9b440f7 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Wed, 29 Oct 2014 20:32:33 -0500 Subject: Add instrumentation Track the number of comparisons, swaps, and rotations performed in each part of the sorting algorithm. --- counts.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 counts.h (limited to 'counts.h') diff --git a/counts.h b/counts.h new file mode 100644 index 0000000..46e2e18 --- /dev/null +++ b/counts.h @@ -0,0 +1,23 @@ +#ifndef COUNTS_H +#define COUNTS_H + +enum { + CURRENT, + SORTNET, + LAST_OVERLAP, + MERGE, + MOVE_BUFFER, + DISTRIBUTE, + MAX_COUNTS +}; + +extern struct counts { + unsigned long compare, swap, rotate; +} counts[MAX_COUNTS]; + +void clear_all_counts(void); +void clear_accumulator(void); +void add_counts(struct counts*, struct counts*); +void print_counts(void); + +#endif -- cgit v1.2.3