summaryrefslogtreecommitdiff
path: root/src/benchmarks
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-30 16:22:27 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-30 16:22:27 -0300
commit6e02d52fbb407e3154a8b990f6403a91697e4cbf (patch)
tree1128e2df7cd71eea5a0ccfc5375b22b2e1017a67 /src/benchmarks
parentad0166f7929f054ba6b72093f8d9e2fb760f9a34 (diff)
eina: Add mempool usage in benchmark
Diffstat (limited to 'src/benchmarks')
-rw-r--r--src/benchmarks/eina/eina_bench_promise.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/benchmarks/eina/eina_bench_promise.c b/src/benchmarks/eina/eina_bench_promise.c
index a6ba2bb..00d55cc 100644
--- a/src/benchmarks/eina/eina_bench_promise.c
+++ b/src/benchmarks/eina/eina_bench_promise.c
@@ -32,6 +32,8 @@
32#include "eina_convert.h" 32#include "eina_convert.h"
33#include "eina_main.h" 33#include "eina_main.h"
34 34
35#include <assert.h>
36
35#include <Eina.h> 37#include <Eina.h>
36 38
37struct value_type 39struct value_type
@@ -42,14 +44,14 @@ struct value_type
42 int h; 44 int h;
43}; 45};
44 46
45void cb(void* data EINA_UNUSED, void* value) 47void cb(void* data EINA_UNUSED, void* value, Eina_Promise* promise EINA_UNUSED)
46{ 48{
47 struct value_type* p = value; 49 struct value_type* p = value;
48 volatile int v = p->x * p->y * p->w * p->h; 50 volatile int v = p->x * p->y * p->w * p->h;
49 (void)v; 51 (void)v;
50} 52}
51 53
52void pointer_cb(void* data EINA_UNUSED, void* value) 54void pointer_cb(void* data EINA_UNUSED, void* value, Eina_Promise* promise EINA_UNUSED)
53{ 55{
54 struct value_type* p = *(struct value_type**)value; 56 struct value_type* p = *(struct value_type**)value;
55 volatile int v = p->x * p->y * p->w * p->h; 57 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)
274 276
275 eina_init(); 277 eina_init();
276 278
277 279 mempool = eina_mempool_add("chained_mempool", "", NULL, sizeof(struct value_type), 10);
280 assert(mempool != NULL);
278 281
279 for (j = 0; j != 200; ++j) 282 for (j = 0; j != 200; ++j)
280 for (i = 0; i != request; ++i) 283 for (i = 0; i != request; ++i)
@@ -307,6 +310,9 @@ eina_bench_promise_pointer_value_set_after_then_pooled(int request)
307 310
308 eina_init(); 311 eina_init();
309 312
313 mempool = eina_mempool_add("chained_mempool", "", NULL, sizeof(struct value_type), 10);
314 assert(mempool != NULL);
315
310 for (j = 0; j != 200; ++j) 316 for (j = 0; j != 200; ++j)
311 for (i = 0; i != request; ++i) 317 for (i = 0; i != request; ++i)
312 { 318 {
@@ -324,6 +330,7 @@ eina_bench_promise_pointer_value_set_after_then_pooled(int request)
324 /* Suppress warnings as we really don't want to do anything. */ 330 /* Suppress warnings as we really don't want to do anything. */
325 (void) tmp; 331 (void) tmp;
326 332
333 eina_mempool_del(mempool);
327 eina_shutdown(); 334 eina_shutdown();
328} 335}
329 336
@@ -352,8 +359,8 @@ void eina_bench_promise(Eina_Benchmark *bench)
352 eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500); 359 eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500);
353 eina_benchmark_register(bench, "promise pointer value set after then mempool", 360 eina_benchmark_register(bench, "promise pointer value set after then mempool",
354 EINA_BENCHMARK( 361 EINA_BENCHMARK(
355 eina_bench_promise_pointer_value_set_after_then), 100, 20100, 500); 362 eina_bench_promise_pointer_value_set_after_then_pooled), 100, 20100, 500);
356 eina_benchmark_register(bench, "promise pointer value set before then mempool", 363 eina_benchmark_register(bench, "promise pointer value set before then mempool",
357 EINA_BENCHMARK( 364 EINA_BENCHMARK(
358 eina_bench_promise_pointer_value_set_before_then), 100, 20100, 500); 365 eina_bench_promise_pointer_value_set_before_then_pooled), 100, 20100, 500);
359} 366}