summaryrefslogtreecommitdiff
path: root/rotate.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 /rotate.c
parent40a6ba5c0a5f544bed9c11dc30b751e05a435b1e (diff)
Add instrumentation
Track the number of comparisons, swaps, and rotations performed in each part of the sorting algorithm.
Diffstat (limited to 'rotate.c')
-rw-r--r--rotate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/rotate.c b/rotate.c
index 5eb7696..1815812 100644
--- a/rotate.c
+++ b/rotate.c
@@ -1,11 +1,14 @@
#include <stddef.h>
#include "common.h"
+#include "counts.h"
/* rotates left */
void rotate(char *base, size_t size, size_t shift)
{
int dir = 1;
+
+ counts[CURRENT].rotate++;
while (shift) {
while (2*shift <= size) {
swap(base, base + dir*shift, shift);