forked from enlightenment/efl
parent
3f59016035
commit
d40ebdca1b
|
@ -164,6 +164,23 @@ fi
|
|||
|
||||
AM_CONDITIONAL(EINA_HAVE_ECORE, test "x${have_ecore}" = "xyes")
|
||||
|
||||
# Check if we want to benchmark on real data
|
||||
enable_bench_e17="no"
|
||||
AC_ARG_ENABLE([benchmark-e17],
|
||||
[AC_HELP_STRING([--enable-benchmark-e17], [disable heavy benchmark @<:@default=no@:>@])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
enable_bench_e17="yes"
|
||||
else
|
||||
enable_bench_e17="no"
|
||||
fi
|
||||
],
|
||||
[enable_bench_e17="no"]
|
||||
)
|
||||
AC_MSG_CHECKING([whether e17 real data benchmark are built])
|
||||
AC_MSG_RESULT([${enable_bench_e17}])
|
||||
AM_CONDITIONAL(EINA_ENABLE_BENCH_E17, test "x${enable_bench_e17}" = "xyes")
|
||||
|
||||
# Check ememoa memory pool library
|
||||
|
||||
if test "x${enable_ememoa}" = "xyes" ; then
|
||||
|
@ -311,6 +328,7 @@ if test "x${enable_bench}" = "xyes" ; then
|
|||
echo " Glib...............: ${have_glib}"
|
||||
echo " Evas...............: ${have_evas}"
|
||||
echo " Ecore..............: ${have_ecore}"
|
||||
echo " E17 real data......: ${enable_bench_e17}"
|
||||
fi
|
||||
echo
|
||||
echo " Memory pool:"
|
||||
|
|
|
@ -32,6 +32,12 @@ AM_CPPFLAGS += -DEINA_BENCH_HAVE_ECORE
|
|||
|
||||
endif
|
||||
|
||||
if EINA_ENABLE_BENCH_E17
|
||||
|
||||
AM_CPPFLAGS += -DEINA_ENABLE_BENCH_E17
|
||||
|
||||
endif
|
||||
|
||||
if EINA_ENABLE_TESTS
|
||||
|
||||
check_PROGRAMS = eina_suite
|
||||
|
@ -69,6 +75,7 @@ eina_bench.c \
|
|||
eina_bench_hash.c \
|
||||
eina_bench_stringshare.c \
|
||||
eina_bench_convert.c \
|
||||
eina_bench_stringshare_e17.c \
|
||||
eina_bench_array.c
|
||||
|
||||
eina_bench_LDADD = @ECORE_LIBS@ @EVAS_LIBS@ @GLIB_LIBS@ $(top_builddir)/src/lib/libeina.la
|
||||
|
|
|
@ -69,5 +69,7 @@ main(int argc, char **argv)
|
|||
eina_benchmark_free(test);
|
||||
}
|
||||
|
||||
eina_bench_e17();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,4 +26,7 @@ void eina_bench_array(Eina_Benchmark *bench);
|
|||
void eina_bench_stringshare(Eina_Benchmark *bench);
|
||||
void eina_bench_convert(Eina_Benchmark *bench);
|
||||
|
||||
/* Specific benchmark. */
|
||||
void eina_bench_e17(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
/* EINA - EFL data type library
|
||||
* Copyright (C) 2008 Cedric Bail
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library;
|
||||
* if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_GLIB
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_EVAS
|
||||
#include <Evas.h>
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_ECORE
|
||||
#include <Ecore_Data.h>
|
||||
#endif
|
||||
|
||||
#include "eina_stringshare.h"
|
||||
#include "eina_counter.h"
|
||||
|
||||
#if EINA_ENABLE_BENCH_E17
|
||||
|
||||
typedef struct _Eina_Stringshare_Test Eina_Stringshare_Test;
|
||||
struct _Eina_Stringshare_Test
|
||||
{
|
||||
const char *name;
|
||||
|
||||
int (*init)(void);
|
||||
const char *(*add)(const char* str);
|
||||
void (*del)(const char* str);
|
||||
int (*shutdown)(void);
|
||||
};
|
||||
|
||||
static const char *strings[30000];
|
||||
static Eina_Stringshare_Test eina_str = {
|
||||
"eina",
|
||||
eina_stringshare_init,
|
||||
eina_stringshare_add,
|
||||
eina_stringshare_del,
|
||||
eina_stringshare_shutdown
|
||||
};
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_EVAS
|
||||
static Eina_Stringshare_Test evas_str = {
|
||||
"evas",
|
||||
evas_init,
|
||||
evas_stringshare_add,
|
||||
evas_stringshare_del,
|
||||
evas_shutdown
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef EINA_BENCH_HAVE_ECORE
|
||||
static Eina_Stringshare_Test ecore_str = {
|
||||
"ecore",
|
||||
ecore_string_init,
|
||||
ecore_string_instance,
|
||||
ecore_string_release,
|
||||
ecore_string_shutdown
|
||||
};
|
||||
#endif
|
||||
|
||||
static Eina_Stringshare_Test* str[] = {
|
||||
&eina_str,
|
||||
#ifdef EINA_BENCH_HAVE_EVAS
|
||||
&evas_str,
|
||||
#endif
|
||||
#ifdef EINA_BENCH_HAVE_ECORE
|
||||
&ecore_str,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
eina_bench_e17_stringshare(Eina_Stringshare_Test *str)
|
||||
{
|
||||
Eina_Counter *cnt;
|
||||
|
||||
cnt = eina_counter_add(str->name);
|
||||
|
||||
eina_counter_start(cnt);
|
||||
|
||||
str->init();
|
||||
|
||||
#include "strlog"
|
||||
|
||||
str->shutdown();
|
||||
|
||||
eina_counter_stop(cnt, 1);
|
||||
|
||||
fprintf(stderr, "For `%s`:\n", str->name);
|
||||
eina_counter_dump(cnt, stderr);
|
||||
|
||||
eina_counter_delete(cnt);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
eina_bench_e17(void)
|
||||
{
|
||||
#if EINA_ENABLE_BENCH_E17
|
||||
int i;
|
||||
|
||||
eina_counter_init();
|
||||
|
||||
for (i = 0; str[i]; ++i)
|
||||
eina_bench_e17_stringshare(str[i]);
|
||||
|
||||
eina_counter_shutdown();
|
||||
#endif
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue