summaryrefslogtreecommitdiff
path: root/src/benchmarks/eo/eo_bench_eo_do.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-03-13 16:32:04 +0000
committerTom Hacohen <tom@stosb.com>2013-03-18 16:14:18 +0000
commite4c00e098aa49929545cc31d9977fbf33a154e09 (patch)
tree82ea00c607aa0336bd568f2b755df08028ae3c18 /src/benchmarks/eo/eo_bench_eo_do.c
parenta1706833346739fd409a61b315b0100e880b3c62 (diff)
Eo: Added an eo_do_super benchmark.
Diffstat (limited to '')
-rw-r--r--src/benchmarks/eo/eo_bench_eo_do.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/benchmarks/eo/eo_bench_eo_do.c b/src/benchmarks/eo/eo_bench_eo_do.c
index f03aa910e0..601290e191 100644
--- a/src/benchmarks/eo/eo_bench_eo_do.c
+++ b/src/benchmarks/eo/eo_bench_eo_do.c
@@ -19,8 +19,57 @@ bench_eo_do_general(int request)
19 eo_unref(obj); 19 eo_unref(obj);
20} 20}
21 21
22static const Eo_Class *cur_klass;
23
24static void
25_a_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
26{
27 int a;
28 a = va_arg(*list, int);
29
30 eo_do_super(obj, cur_klass, simple_a_set(a));
31}
32
33static void
34_class_constructor(Eo_Class *klass)
35{
36 const Eo_Op_Func_Description func_desc[] = {
37 EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
38 EO_OP_FUNC_SENTINEL
39 };
40
41 eo_class_funcs_set(klass, func_desc);
42}
43
44static void
45bench_eo_do_super(int request)
46{
47 static Eo_Class_Description class_desc = {
48 EO_VERSION,
49 "Simple2",
50 EO_CLASS_TYPE_REGULAR,
51 EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
52 NULL,
53 0,
54 _class_constructor,
55 NULL
56 };
57 cur_klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL);
58
59 int i;
60 Eo *obj = eo_add(cur_klass, NULL);
61 for (i = 0 ; i < request ; i++)
62 {
63 eo_do(obj, simple_a_set(i));
64 }
65
66 eo_unref(obj);
67}
68
22void eo_bench_eo_do(Eina_Benchmark *bench) 69void eo_bench_eo_do(Eina_Benchmark *bench)
23{ 70{
24 eina_benchmark_register(bench, "various", 71 eina_benchmark_register(bench, "various",
25 EINA_BENCHMARK(bench_eo_do_general), 1000, 100000, 500); 72 EINA_BENCHMARK(bench_eo_do_general), 1000, 100000, 500);
73 eina_benchmark_register(bench, "super",
74 EINA_BENCHMARK(bench_eo_do_super), 1000, 100000, 500);
26} 75}