8 #define TRANSPORT "dummy"
10 long current_time(
void)
16 clock_gettime(CLOCK_REALTIME, &spec);
19 ms = s * 1000 + round(spec.tv_nsec / 1.0e6);
25 void unhandled_cb(
struct aura_node *dev,
33 long run_first(
struct aura_node *n)
37 long start = current_time();
38 for (i=0; i<90000; i++) {
39 aura_call(n,
"echo_u16", &retbuf, 0x0102);
43 aura_call(n,
"echo_u32", &retbuf, 0x0102);
45 aura_call(n,
"echo_u64", &retbuf, 0x0102);
48 return current_time() - start;
52 long run_second(
struct aura_node *n)
55 long start = current_time();
57 for (i=0; i<90000; i++) {
61 return current_time() - start;
64 void average_aggregate(
struct aura_node *n,
long (*test)(
struct aura_node *n),
int runs,
char *lbl)
68 for (i=0; i<runs; i++)
71 printf(
"%lu \t ms avg of %d runs (%s)\n", v, runs, lbl);
77 #ifdef AURA_USE_BUFFER_POOL
78 printf(
"Buffer pool enabled!");
80 printf(
"Buffer pool disabled!");
83 struct aura_node *n =
aura_open(TRANSPORT, NULL);
84 printf(
"+GC -PREHEAT\n");
86 average_aggregate(n, run_first, num_runs,
"call test");
92 printf(
"+GC +PREHEAT\n");
95 average_aggregate(n, run_first, num_runs,
"call test");
101 printf(
"-GC -PREHEAT\n");
103 n->gc_threshold = -1;
104 average_aggregate(n, run_first, num_runs,
"call test");
struct aura_buffer * aura_buffer_request(struct aura_node *nd, int size)
void aura_bufferpool_preheat(struct aura_node *nd, int size, int count)
int aura_call(struct aura_node *node, const char *name, struct aura_buffer **retbuf,...)
struct aura_node * aura_open(const char *name, const char *opts)
void aura_unhandled_evt_cb(struct aura_node *node, void(*cb)(struct aura_node *node, struct aura_buffer *buf, void *arg), void *arg)
void aura_buffer_release(struct aura_buffer *buf)
void aura_close(struct aura_node *node)