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. --- testcases.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'testcases.c') diff --git a/testcases.c b/testcases.c index 1a50632..a41cd89 100644 --- a/testcases.c +++ b/testcases.c @@ -3,9 +3,10 @@ #include #include "testcases.h" +#include "common.h" +#include "counts.h" int buffer[MAX_SIZE]; -unsigned long comparisons; void assert_sorted(size_t size, cmpfun cmp) { @@ -19,7 +20,7 @@ static int compare(const void *a, const void *b) const int *aa = a; const int *bb = b; - comparisons++; + counts[CURRENT].compare++; if (*aa < *bb) return -1; else if (*aa > *bb) -- cgit v1.2.3