From 0866206c1f6ac8a2180adf465a1aac70ae837fca Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 27 Dec 2012 19:43:25 -0500 Subject: [PATCH] regressions/ck_ring: Add ck_ring_spmc to fast path test. --- regressions/ck_ring/benchmark/latency.c | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/regressions/ck_ring/benchmark/latency.c b/regressions/ck_ring/benchmark/latency.c index 5901806..332e436 100644 --- a/regressions/ck_ring/benchmark/latency.c +++ b/regressions/ck_ring/benchmark/latency.c @@ -64,6 +64,31 @@ main(int argc, char *argv[]) d_a += (e - s) / 4; } - printf("%10d %16" PRIu64 " %16" PRIu64 "\n", size, e_a / ITERATIONS, d_a / ITERATIONS); + printf("spsc %10d %16" PRIu64 " %16" PRIu64 "\n", size, e_a / ITERATIONS, d_a / ITERATIONS); + + e_a = d_a = s = e = 0; + for (r = 0; r < ITERATIONS; r++) { + for (i = 0; i < size / 4; i += 4) { + s = rdtsc(); + CK_RING_ENQUEUE_SPMC(entry_ring, &ring, &entry); + CK_RING_ENQUEUE_SPMC(entry_ring, &ring, &entry); + CK_RING_ENQUEUE_SPMC(entry_ring, &ring, &entry); + CK_RING_ENQUEUE_SPMC(entry_ring, &ring, &entry); + e = rdtsc(); + } + e_a += (e - s) / 4; + + for (i = 0; i < size / 4; i += 4) { + s = rdtsc(); + CK_RING_DEQUEUE_SPMC(entry_ring, &ring, &entry); + CK_RING_DEQUEUE_SPMC(entry_ring, &ring, &entry); + CK_RING_DEQUEUE_SPMC(entry_ring, &ring, &entry); + CK_RING_DEQUEUE_SPMC(entry_ring, &ring, &entry); + e = rdtsc(); + } + d_a += (e - s) / 4; + } + + printf("spmc %10d %16" PRIu64 " %16" PRIu64 "\n", size, e_a / ITERATIONS, d_a / ITERATIONS); return (0); }