summaryrefslogtreecommitdiff
path: root/testcases.c
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2014-10-29 20:32:33 -0500
committerBobby Bingham <koorogi@koorogi.info>2014-10-29 20:32:33 -0500
commit8a27889d505b07d91ecd03ad1cfeb818b9b440f7 (patch)
tree733e342e932f67aa56b9554b6d901fea129ad578 /testcases.c
parent40a6ba5c0a5f544bed9c11dc30b751e05a435b1e (diff)
Add instrumentation
Track the number of comparisons, swaps, and rotations performed in each part of the sorting algorithm.
Diffstat (limited to 'testcases.c')
-rw-r--r--testcases.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/testcases.c b/testcases.c
index 1a50632..a41cd89 100644
--- a/testcases.c
+++ b/testcases.c
@@ -3,9 +3,10 @@
#include <stdlib.h>
#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)