aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2013-04-18 13:55:11 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2013-04-23 08:52:43 +0300
commitb503a681ae87916954bf58b92e6114d3f30c9298 (patch)
tree5444a54fa1289d03b20c18d50629e79e06f2293e
parentfix recursive proxy rendering to just show a black rectangle (diff)
downloadefl-b503a681ae87916954bf58b92e6114d3f30c9298.tar.gz
Eo: add benchmarks to measure eo_add.
The first one checks simple objects creation. The second one creates objects, removes half of them and creates the same number.
-rw-r--r--src/benchmarks/eo/Makefile.am3
-rw-r--r--src/benchmarks/eo/eo_bench.c1
-rw-r--r--src/benchmarks/eo/eo_bench.h1
-rw-r--r--src/benchmarks/eo/eo_bench_eo_add.c47
4 files changed, 51 insertions, 1 deletions
diff --git a/src/benchmarks/eo/Makefile.am b/src/benchmarks/eo/Makefile.am
index 69b3dc1849..d796710a7c 100644
--- a/src/benchmarks/eo/Makefile.am
+++ b/src/benchmarks/eo/Makefile.am
@@ -17,7 +17,8 @@ class_simple.c \
class_simple.h \
eo_bench.c \
eo_bench.h \
-eo_bench_eo_do.c
+eo_bench_eo_do.c \
+eo_bench_eo_add.c
eo_bench_LDADD = \
$(top_builddir)/src/lib/eo/libeo.la \
diff --git a/src/benchmarks/eo/eo_bench.c b/src/benchmarks/eo/eo_bench.c
index 0da83a1f34..9266e6efe2 100644
--- a/src/benchmarks/eo/eo_bench.c
+++ b/src/benchmarks/eo/eo_bench.c
@@ -20,6 +20,7 @@ struct _Eina_Benchmark_Case
static const Eina_Benchmark_Case etc[] = {
{ "eo_do", eo_bench_eo_do },
+ { "eo_add", eo_bench_eo_add },
{ NULL, NULL }
};
diff --git a/src/benchmarks/eo/eo_bench.h b/src/benchmarks/eo/eo_bench.h
index feea3bc333..2513426314 100644
--- a/src/benchmarks/eo/eo_bench.h
+++ b/src/benchmarks/eo/eo_bench.h
@@ -2,5 +2,6 @@
#define EINA_BENCH_H_
void eo_bench_eo_do(Eina_Benchmark *bench);
+void eo_bench_eo_add(Eina_Benchmark *bench);
#endif
diff --git a/src/benchmarks/eo/eo_bench_eo_add.c b/src/benchmarks/eo/eo_bench_eo_add.c
new file mode 100644
index 0000000000..ce0bdc9c8c
--- /dev/null
+++ b/src/benchmarks/eo/eo_bench_eo_add.c
@@ -0,0 +1,47 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "Eo.h"
+#include "eo_bench.h"
+#include "class_simple.h"
+
+static void
+bench_eo_add_linear(int request)
+{
+ int i;
+ Eo **objs = calloc(request, sizeof(Eo *));
+ for (i = 0 ; i < request ; i++)
+ objs[i] = eo_add(SIMPLE_CLASS, NULL);
+
+ for (i = 0 ; i < request ; i++)
+ eo_unref(objs[i]);
+ free(objs);
+}
+
+static void
+bench_eo_add_jump_by_2(int request)
+{
+ int i;
+ Eo **objs = calloc(request, sizeof(Eo *));
+ for (i = 0 ; i < request ; i++)
+ objs[i] = eo_add(SIMPLE_CLASS, NULL);
+
+ for (i = 0 ; i < request ; i += 2)
+ eo_unref(objs[i]);
+
+ for (i = 0 ; i < request ; i += 2)
+ objs[i] = eo_add(SIMPLE_CLASS, NULL);
+
+ for (i = 0 ; i < request ; i++)
+ eo_unref(objs[i]);
+ free(objs);
+}
+
+void eo_bench_eo_add(Eina_Benchmark *bench)
+{
+ eina_benchmark_register(bench, "eo_add_linear",
+ EINA_BENCHMARK(bench_eo_add_linear), 1000, 50000, 100);
+ eina_benchmark_register(bench, "eo_add_jump_by_2",
+ EINA_BENCHMARK(bench_eo_add_jump_by_2), 1000, 50000, 100);
+}