forked from enlightenment/efl
eina: Add mempool usage in benchmark
This commit is contained in:
parent
ad0166f792
commit
6e02d52fbb
|
@ -32,6 +32,8 @@
|
||||||
#include "eina_convert.h"
|
#include "eina_convert.h"
|
||||||
#include "eina_main.h"
|
#include "eina_main.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
|
|
||||||
struct value_type
|
struct value_type
|
||||||
|
@ -42,14 +44,14 @@ struct value_type
|
||||||
int h;
|
int h;
|
||||||
};
|
};
|
||||||
|
|
||||||
void cb(void* data EINA_UNUSED, void* value)
|
void cb(void* data EINA_UNUSED, void* value, Eina_Promise* promise EINA_UNUSED)
|
||||||
{
|
{
|
||||||
struct value_type* p = value;
|
struct value_type* p = value;
|
||||||
volatile int v = p->x * p->y * p->w * p->h;
|
volatile int v = p->x * p->y * p->w * p->h;
|
||||||
(void)v;
|
(void)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pointer_cb(void* data EINA_UNUSED, void* value)
|
void pointer_cb(void* data EINA_UNUSED, void* value, Eina_Promise* promise EINA_UNUSED)
|
||||||
{
|
{
|
||||||
struct value_type* p = *(struct value_type**)value;
|
struct value_type* p = *(struct value_type**)value;
|
||||||
volatile int v = p->x * p->y * p->w * p->h;
|
volatile int v = p->x * p->y * p->w * p->h;
|
||||||
|
@ -274,7 +276,8 @@ eina_bench_promise_pointer_value_set_before_then_pooled(int request)
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
|
|
||||||
|
mempool = eina_mempool_add("chained_mempool", "", NULL, sizeof(struct value_type), 10);
|
||||||
|
assert(mempool != NULL);
|
||||||
|
|
||||||
for (j = 0; j != 200; ++j)
|
for (j = 0; j != 200; ++j)
|
||||||
for (i = 0; i != request; ++i)
|
for (i = 0; i != request; ++i)
|
||||||
|
@ -307,6 +310,9 @@ eina_bench_promise_pointer_value_set_after_then_pooled(int request)
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
|
|
||||||
|
mempool = eina_mempool_add("chained_mempool", "", NULL, sizeof(struct value_type), 10);
|
||||||
|
assert(mempool != NULL);
|
||||||
|
|
||||||
for (j = 0; j != 200; ++j)
|
for (j = 0; j != 200; ++j)
|
||||||
for (i = 0; i != request; ++i)
|
for (i = 0; i != request; ++i)
|
||||||
{
|
{
|
||||||
|
@ -324,6 +330,7 @@ eina_bench_promise_pointer_value_set_after_then_pooled(int request)
|
||||||
/* Suppress warnings as we really don't want to do anything. */
|
/* Suppress warnings as we really don't want to do anything. */
|
||||||
(void) tmp;
|
(void) tmp;
|
||||||
|
|
||||||
|
eina_mempool_del(mempool);
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,8 +359,8 @@ void eina_bench_promise(Eina_Benchmark *bench)
|
||||||
eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500);
|
eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500);
|
||||||
eina_benchmark_register(bench, "promise pointer value set after then mempool",
|
eina_benchmark_register(bench, "promise pointer value set after then mempool",
|
||||||
EINA_BENCHMARK(
|
EINA_BENCHMARK(
|
||||||
eina_bench_promise_pointer_value_set_after_then), 100, 20100, 500);
|
eina_bench_promise_pointer_value_set_after_then_pooled), 100, 20100, 500);
|
||||||
eina_benchmark_register(bench, "promise pointer value set before then mempool",
|
eina_benchmark_register(bench, "promise pointer value set before then mempool",
|
||||||
EINA_BENCHMARK(
|
EINA_BENCHMARK(
|
||||||
eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500);
|
eina_bench_promise_pointer_value_set_before_then_pooled), 100, 20100, 500);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue