Update benchmarks and examples
This commit is contained in:
1 parent
33c33e8947
commit
415720c6a6
5 files changed
+34
-42
No files matched your search
@@ -18,16 +18,12 @@
|
||||
|
||||
#if defined(CMC_QUEUE)
|
||||
#include "cmc/queue.h"
|
||||
QUEUE_GENERATE(q, queue, , int)
|
||||
CMC_GENERATE_QUEUE(q, queue, int)
|
||||
#define TARGET "QUEUE"
|
||||
#elif defined(SAC_QUEUE)
|
||||
#include "sac/queue.h"
|
||||
SAC_QUEUE_GENERATE(q, queue, , int, MAX)
|
||||
#define TARGET "SAC QUEUE"
|
||||
#elif defined(EXT_QUEUE)
|
||||
#include "ext/linkedqueue.h"
|
||||
LINKEDQUEUE_GENERATE(q, queue, , int)
|
||||
#define TARGET "LINKED QUEUE"
|
||||
#else
|
||||
#error Please define either CMC_QUEUE, SAC_QUEUE or EXT_QUEUE
|
||||
#endif
|
||||
@@ -36,19 +32,17 @@ int main(void)
|
||||
{
|
||||
|
||||
#if defined(CMC_QUEUE)
|
||||
queue *q = q_new(MAX);
|
||||
struct queue *q = q_new(MAX);
|
||||
#elif defined(SAC_QUEUE)
|
||||
queue _q = q_new();
|
||||
queue_ptr q = &_q;
|
||||
#elif defined(EXT_QUEUE)
|
||||
queue *q = q_new();
|
||||
#endif
|
||||
|
||||
size_t sum = 0;
|
||||
int i = 0;
|
||||
|
||||
timer_t timer;
|
||||
TIMER_START(timer);
|
||||
struct cmc_timer timer;
|
||||
cmc_timer_start(timer);
|
||||
|
||||
while (q_count(q) != MAX)
|
||||
{
|
||||
@@ -65,8 +59,8 @@ int main(void)
|
||||
|
||||
}
|
||||
|
||||
TIMER_STOP(timer);
|
||||
TIMER_CALC(timer);
|
||||
cmc_timer_stop(timer);
|
||||
cmc_timer_calc(timer);
|
||||
|
||||
printf("----------------------------------------\n");
|
||||
printf("%s\n", TARGET);
|
||||
@@ -74,8 +68,8 @@ int main(void)
|
||||
printf("SUM: %" PRIuMAX "\n", sum);
|
||||
printf("----------------------------------------\n");
|
||||
|
||||
#if defined(CMC_QUEUE) || defined(EXT_QUEUE)
|
||||
q_free(q);
|
||||
#if defined(CMC_QUEUE)
|
||||
q_free(q, NULL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user