summaryrefslogtreecommitdiff
path: root/src/benchmarks
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-09-26 15:04:21 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-09-26 15:51:25 +0900
commit46ca166599413e17fc235da72cbadedd3b747a83 (patch)
tree3e36585095ba32f1ff1b702e63151ca9764ae60d /src/benchmarks
parent295babadb1675d1160b18c639dd6dcbe20b02cfb (diff)
eina: improve benchmark logic to be able to choose which one to run.
Note: Eina_Hash benchmark is not really matching all our usecase. We need a better tests that would expand the bench with a wider range of key size. Basically giving a 3d dimension to our gnuplot. Don't know if it is doable.
Diffstat (limited to 'src/benchmarks')
-rw-r--r--src/benchmarks/eina/eina_bench.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/src/benchmarks/eina/eina_bench.c b/src/benchmarks/eina/eina_bench.c
index 5bd35f819b..a226fd9892 100644
--- a/src/benchmarks/eina/eina_bench.c
+++ b/src/benchmarks/eina/eina_bench.c
@@ -32,18 +32,19 @@ struct _Eina_Benchmark_Case
32{ 32{
33 const char *bench_case; 33 const char *bench_case;
34 void (*build)(Eina_Benchmark *bench); 34 void (*build)(Eina_Benchmark *bench);
35 Eina_Bool run_by_default;
35}; 36};
36 37
37static const Eina_Benchmark_Case etc[] = { 38static const Eina_Benchmark_Case etc[] = {
38 { "Hash", eina_bench_hash }, 39 { "Hash", eina_bench_hash, EINA_TRUE },
39 /* { "Array vs List vs Inlist", eina_bench_array }, */ 40 { "Array vs List vs Inlist", eina_bench_array, EINA_TRUE },
40 /* { "Stringshare", eina_bench_stringshare }, */ 41 { "Stringshare", eina_bench_stringshare, EINA_TRUE },
41 /* { "Convert", eina_bench_convert }, */ 42 { "Convert", eina_bench_convert, EINA_TRUE },
42 /* { "Sort", eina_bench_sort }, */ 43 { "Sort", eina_bench_sort, EINA_TRUE },
43 /* { "Mempool", eina_bench_mempool }, */ 44 { "Mempool", eina_bench_mempool, EINA_TRUE },
44 /* { "Rectangle_Pool", eina_bench_rectangle_pool }, */ 45 { "Rectangle_Pool", eina_bench_rectangle_pool, EINA_TRUE },
45 // { "Render Loop", eina_bench_quadtree }, 46 { "Render Loop", eina_bench_quadtree, EINA_FALSE },
46 { NULL, NULL } 47 { NULL, NULL, EINA_FALSE }
47}; 48};
48 49
49/* FIXME this is a copy from eina_test_mempool 50/* FIXME this is a copy from eina_test_mempool
@@ -75,24 +76,45 @@ main(int argc, char **argv)
75 Eina_Benchmark *test; 76 Eina_Benchmark *test;
76 unsigned int i; 77 unsigned int i;
77 78
78 if (argc != 2)
79 return -1;
80
81 _mempool_init(); 79 _mempool_init();
82 80
83 eina_init(); 81 eina_init();
84 82
85 for (i = 0; etc[i].bench_case; ++i) 83 switch (argc)
86 { 84 {
87 test = eina_benchmark_new(etc[i].bench_case, argv[1]); 85 case 1:
88 if (!test) 86 for (i = 0; etc[i].bench_case; ++i)
89 continue; 87 if (etc[i].run_by_default)
88 {
89 test = eina_benchmark_new(etc[i].bench_case, "default");
90 if (!test) continue;
91
92 etc[i].build(test);
93
94 eina_benchmark_run(test);
95
96 eina_benchmark_free(test);
97 }
98 break;
99 case 2:
100 for (i = 0; etc[i].bench_case; ++i)
101 {
102 if (strcasecmp(etc[i].bench_case, argv[1]))
103 continue;
104
105 test = eina_benchmark_new(etc[i].bench_case, argv[1]);
106 if (!test)
107 continue;
108
109 etc[i].build(test);
90 110
91 etc[i].build(test); 111 eina_benchmark_run(test);
92 112
93 eina_benchmark_run(test); 113 eina_benchmark_free(test);
94 114
95 eina_benchmark_free(test); 115 break;
116 }
117 break;
96 } 118 }
97 119
98 eina_bench_e17(); 120 eina_bench_e17();