summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am3
-rw-r--r--src/benchmarks/evas/.gitignore1
-rw-r--r--src/benchmarks/evas/Makefile.am35
-rw-r--r--src/benchmarks/evas/evas_bench.c54
-rw-r--r--src/benchmarks/evas/evas_bench.h10
-rw-r--r--src/benchmarks/evas/evas_bench_loader.c92
-rw-r--r--src/benchmarks/evas/evas_bench_saver.c74
8 files changed, 269 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index a848345bda..82418f32aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4080,6 +4080,7 @@ doc/previews/Makefile
4080src/Makefile 4080src/Makefile
4081src/benchmarks/eina/Makefile 4081src/benchmarks/eina/Makefile
4082src/benchmarks/eo/Makefile 4082src/benchmarks/eo/Makefile
4083src/benchmarks/evas/Makefile
4083src/examples/eina/Makefile 4084src/examples/eina/Makefile
4084src/examples/eina_cxx/Makefile 4085src/examples/eina_cxx/Makefile
4085src/examples/eet/Makefile 4086src/examples/eet/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index f9c2497f4a..58270c792e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,7 +73,8 @@ include Makefile_Eina_Cxx.am
73 73
74BENCHMARK_SUBDIRS = \ 74BENCHMARK_SUBDIRS = \
75benchmarks/eina \ 75benchmarks/eina \
76benchmarks/eo 76benchmarks/eo \
77benchmarks/evas
77DIST_SUBDIRS += $(BENCHMARK_SUBDIRS) 78DIST_SUBDIRS += $(BENCHMARK_SUBDIRS)
78 79
79benchmark: all-am 80benchmark: all-am
diff --git a/src/benchmarks/evas/.gitignore b/src/benchmarks/evas/.gitignore
new file mode 100644
index 0000000000..aee0b35dc7
--- /dev/null
+++ b/src/benchmarks/evas/.gitignore
@@ -0,0 +1 @@
/evas_bench
diff --git a/src/benchmarks/evas/Makefile.am b/src/benchmarks/evas/Makefile.am
new file mode 100644
index 0000000000..31c9d72321
--- /dev/null
+++ b/src/benchmarks/evas/Makefile.am
@@ -0,0 +1,35 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_builddir)/src/lib/efl \
5-I$(top_srcdir)/src/lib/eina \
6-I$(top_builddir)/src/lib/eina \
7-I$(top_srcdir)/src/modules/evas/engines/buffer \
8-DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)\" \
9-DTESTS_SRC_DIR=\"$(abs_top_srcdir)/src/tests/evas\" \
10@EVAS_CFLAGS@
11
12EXTRA_PROGRAMS = evas_bench
13
14benchmark: evas_bench
15
16evas_bench_SOURCES = \
17evas_bench.c \
18evas_bench_loader.c \
19evas_bench_saver.c \
20evas_bench.h
21
22nodist_EXTRA_evas_bench_SOURCES = dummy.cc
23evas_bench_LDADD = \
24$(top_builddir)/src/lib/evas/libevas.la \
25$(top_builddir)/src/lib/eina/libeina.la \
26@EVAS_LDFLAGS@
27
28EXTRA_DIST =
29
30clean-local:
31 rm -rf *.gcno ..\#..\#src\#*.gcov *.gcda
32
33if ALWAYS_BUILD_EXAMPLES
34noinst_PROGRAMS = $(EXTRA_PROGRAMS)
35endif
diff --git a/src/benchmarks/evas/evas_bench.c b/src/benchmarks/evas/evas_bench.c
new file mode 100644
index 0000000000..58b806e0c3
--- /dev/null
+++ b/src/benchmarks/evas/evas_bench.c
@@ -0,0 +1,54 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <limits.h>
8
9#include "evas_bench.h"
10#include "Eina.h"
11#include "Evas.h"
12
13typedef struct _Evas_Benchmark_Case Evas_Benchmark_Case;
14struct _Evas_Benchmark_Case
15{
16 const char *bench_case;
17 void (*build)(Eina_Benchmark *bench);
18 Eina_Bool run_by_default;
19};
20
21static const Evas_Benchmark_Case etc[] = {
22 { "Loader", evas_bench_loader, EINA_TRUE },
23 { "Saver", evas_bench_saver, EINA_TRUE },
24 { NULL, NULL, EINA_FALSE }
25};
26
27int
28main(int argc, char **argv)
29{
30 Eina_Benchmark *test;
31 unsigned int i;
32
33 evas_init();
34
35 for (i = 0; etc[i].bench_case; ++i)
36 {
37 if (argc == 2 && strcasecmp(etc[i].bench_case, argv[1]))
38 continue;
39
40 test = eina_benchmark_new(etc[i].bench_case, "default");
41 if (!test)
42 continue;
43
44 etc[i].build(test);
45
46 eina_benchmark_run(test);
47
48 eina_benchmark_free(test);
49 }
50
51 evas_shutdown();
52
53 return 0;
54}
diff --git a/src/benchmarks/evas/evas_bench.h b/src/benchmarks/evas/evas_bench.h
new file mode 100644
index 0000000000..cf57213e90
--- /dev/null
+++ b/src/benchmarks/evas/evas_bench.h
@@ -0,0 +1,10 @@
1#ifndef EVAS_BENCH_H_
2#define EVAS_BENCH_H_
3
4#include "eina_benchmark.h"
5
6void evas_bench_loader(Eina_Benchmark *bench);
7void evas_bench_saver(Eina_Benchmark *bench);
8
9#endif
10
diff --git a/src/benchmarks/evas/evas_bench_loader.c b/src/benchmarks/evas/evas_bench_loader.c
new file mode 100644
index 0000000000..77c168465f
--- /dev/null
+++ b/src/benchmarks/evas/evas_bench_loader.c
@@ -0,0 +1,92 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "Evas.h"
6#include "Evas_Engine_Buffer.h"
7#include "evas_bench.h"
8
9static const char *
10_test_image_get(const char *name)
11{
12 static char filename[PATH_MAX];
13
14 snprintf(filename, PATH_MAX, TESTS_SRC_DIR"/images/%s", name);
15
16 return filename;
17}
18
19static Evas *
20_setup_evas()
21{
22 Evas *evas;
23 Evas_Engine_Info_Buffer *einfo;
24
25 evas = evas_new();
26
27 evas_output_method_set(evas, evas_render_method_lookup("buffer"));
28 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(evas);
29
30 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
31 einfo->info.dest_buffer = malloc(sizeof (char) * 500 * 500 * 4);
32 einfo->info.dest_buffer_row_bytes = 500 * sizeof (char) * 4;
33
34 evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
35
36 evas_output_size_set(evas, 500, 500);
37 evas_output_viewport_set(evas, 0, 0, 500, 500);
38
39 return evas;
40}
41
42static void
43evas_bench_loader_tgv(int request)
44{
45 Evas *e = _setup_evas();
46 char *large;
47 char *small;
48 char *computer;
49 Evas_Object *o;
50 Eina_List *l;
51 int i;
52
53 large = strdup(_test_image_get("Light-50.tgv"));
54 small = strdup(_test_image_get("Sunrise-100.tgv"));
55 computer = strdup(_test_image_get("Pic1-50.tgv"));
56
57 for (i = 0; i < request; i++)
58 {
59 o = evas_object_image_add(e);
60
61 evas_object_image_file_set(o, large, NULL);
62 if (!evas_object_image_data_get(o, 0)) break ;
63
64 evas_object_image_file_set(o, small, NULL);
65 if (!evas_object_image_data_get(o, 0)) break ;
66
67 evas_object_image_file_set(o, computer, NULL);
68 if (!evas_object_image_data_get(o, 0)) break ;
69
70 evas_object_del(o);
71
72 l = evas_render_updates(e);
73 evas_render_updates_free(l);
74
75 evas_render_idle_flush(e);
76 evas_render_dump(e);
77 }
78
79 fprintf(stderr, "i: %i (%s, %s, %s)\n",
80 i, large, small, computer);
81
82 free(large);
83 free(small);
84 free(computer);
85
86 evas_free(e);
87}
88
89void evas_bench_loader(Eina_Benchmark *bench)
90{
91 eina_benchmark_register(bench, "tgv-loader", EINA_BENCHMARK(evas_bench_loader_tgv), 20, 2000, 100);
92}
diff --git a/src/benchmarks/evas/evas_bench_saver.c b/src/benchmarks/evas/evas_bench_saver.c
new file mode 100644
index 0000000000..c278b843e2
--- /dev/null
+++ b/src/benchmarks/evas/evas_bench_saver.c
@@ -0,0 +1,74 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <fcntl.h>
6#include <unistd.h>
7
8#include "Evas.h"
9#include "Evas_Engine_Buffer.h"
10#include "evas_bench.h"
11
12static const char *
13_test_image_get(const char *name)
14{
15 static char filename[PATH_MAX];
16
17 snprintf(filename, PATH_MAX, TESTS_SRC_DIR"/images/%s", name);
18
19 return filename;
20}
21
22static Evas *
23_setup_evas()
24{
25 Evas *evas;
26 Evas_Engine_Info_Buffer *einfo;
27
28 evas = evas_new();
29
30 evas_output_method_set(evas, evas_render_method_lookup("buffer"));
31 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(evas);
32
33 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
34 einfo->info.dest_buffer = malloc(sizeof (char) * 500 * 500 * 4);
35 einfo->info.dest_buffer_row_bytes = 500 * sizeof (char) * 4;
36
37 evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
38
39 evas_output_size_set(evas, 500, 500);
40 evas_output_viewport_set(evas, 0, 0, 500, 500);
41
42 return evas;
43}
44
45static void
46evas_bench_saver_tgv(int request)
47{
48 Evas *e = _setup_evas();
49 const char *source;
50 Eina_Tmpstr *dest;
51 Evas_Object *o;
52 int i;
53
54 source = _test_image_get("mars_rover_panorama_half-size.jpg");
55 eina_file_mkstemp("evas_saver_benchXXXXXX", &dest);
56
57 o = evas_object_image_add(e);
58 evas_object_image_file_set(o, source, NULL);
59
60 for (i = 0; i < request; i++)
61 {
62 evas_object_image_save(o, dest, NULL, "compress=1 quality=50");
63 }
64
65 unlink(dest);
66 eina_tmpstr_del(dest);
67
68 evas_free(e);
69}
70
71void evas_bench_saver(Eina_Benchmark *bench)
72{
73 eina_benchmark_register(bench, "tgv-saver", EINA_BENCHMARK(evas_bench_saver_tgv), 20, 2000, 100);
74}