aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/tests/eina_bench_rectangle_pool.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/tests/eina_bench_rectangle_pool.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/eina/src/tests/eina_bench_rectangle_pool.c')
-rw-r--r--libraries/eina/src/tests/eina_bench_rectangle_pool.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/libraries/eina/src/tests/eina_bench_rectangle_pool.c b/libraries/eina/src/tests/eina_bench_rectangle_pool.c
new file mode 100644
index 0000000..96d4b1b
--- /dev/null
+++ b/libraries/eina/src/tests/eina_bench_rectangle_pool.c
@@ -0,0 +1,76 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2008 Cedric Bail
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#include "eina_bench.h"
24#include "Eina.h"
25
26static void
27eina_bench_eina_rectangle_pool(int request)
28{
29 Eina_Rectangle_Pool *pool;
30 Eina_Rectangle *rect;
31 Eina_List *list = NULL;
32 int i;
33
34 eina_init();
35 eina_init();
36
37 pool = eina_rectangle_pool_new(2048, 2048);
38 if (!pool)
39 return;
40
41 for (i = 0; i < request; ++i)
42 {
43 rect = NULL;
44
45 while (!rect)
46 {
47 rect = eina_rectangle_pool_request(pool, i & 0xFF, 256 - (i & 0xFF));
48 if (!rect)
49 {
50 rect = eina_list_data_get(list);
51 list = eina_list_remove_list(list, list);
52 if (rect)
53 eina_rectangle_pool_release(rect);
54 }
55 else
56 list = eina_list_append(list, rect);
57
58 if (!(i & 0xFF))
59 break;
60 }
61 }
62
63 eina_rectangle_pool_free(pool);
64 eina_list_free(list);
65
66 eina_shutdown();
67}
68
69void eina_bench_rectangle_pool(Eina_Benchmark *bench)
70{
71 eina_benchmark_register(bench, "eina",
72 EINA_BENCHMARK(
73 eina_bench_eina_rectangle_pool), 10, 4000, 100);
74}
75
76