aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/tests/eina_bench_stringshare_e17.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/tests/eina_bench_stringshare_e17.c')
-rw-r--r--libraries/eina/src/tests/eina_bench_stringshare_e17.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/libraries/eina/src/tests/eina_bench_stringshare_e17.c b/libraries/eina/src/tests/eina_bench_stringshare_e17.c
new file mode 100644
index 0000000..6ab0a80
--- /dev/null
+++ b/libraries/eina/src/tests/eina_bench_stringshare_e17.c
@@ -0,0 +1,118 @@
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 <stdlib.h>
24#include <stdio.h>
25#include <time.h>
26
27#ifdef EINA_BENCH_HAVE_GLIB
28# include <glib.h>
29#endif
30
31#include "Evas_Data.h"
32#include "Ecore_Data.h"
33
34#include "Eina.h"
35
36#if EINA_ENABLE_BENCH_E17
37
38typedef struct _Eina_Stringshare_Test Eina_Stringshare_Test;
39struct _Eina_Stringshare_Test
40{
41 const char *name;
42
43 int (*init)(void);
44 const char *(*add)(const char *str);
45 void (*del)(const char *str);
46 int (*shutdown)(void);
47};
48
49static const char *strings[30000];
50static Eina_Stringshare_Test eina_str = {
51 "eina",
52 eina_init,
53 eina_stringshare_add,
54 eina_stringshare_del,
55 eina_shutdown
56};
57
58static Eina_Stringshare_Test evas_str = {
59 "evas",
60/* evas_stringshare_init, */
61 evas_stringshare_add,
62 evas_stringshare_del
63/* evas_stringshare_shutdown */
64};
65
66static Eina_Stringshare_Test ecore_str = {
67 "ecore",
68 ecore_string_init,
69 ecore_string_instance,
70 ecore_string_release,
71 ecore_string_shutdown
72};
73
74static Eina_Stringshare_Test *str[] = {
75 &eina_str,
76 &evas_str,
77 &ecore_str,
78 NULL
79};
80
81static void
82eina_bench_e17_stringshare(Eina_Stringshare_Test *str)
83{
84 Eina_Counter *cnt;
85
86 cnt = eina_counter_new(str->name);
87
88 eina_counter_start(cnt);
89
90 str->init();
91
92#include "strlog"
93
94 str->shutdown();
95
96 eina_counter_stop(cnt, 1);
97
98 fprintf(stderr, "For `%s`:\n", str->name);
99 eina_counter_dump(cnt);
100
101 eina_counter_free(cnt);
102}
103#endif
104
105void
106eina_bench_e17(void)
107{
108#if EINA_ENABLE_BENCH_E17
109 int i;
110
111 eina_init();
112
113 for (i = 0; str[i]; ++i)
114 eina_bench_e17_stringshare(str[i]);
115
116 eina_shutdown();
117#endif
118}