efl/src/benchmarks/eo/eo_bench_eo_do.c

62 lines
1.2 KiB
C
Raw Normal View History

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
#include "eo_bench.h"
#include "class_simple.h"
static void
bench_eo_do_general(int request)
{
int i;
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
for (i = 0 ; i < request ; i++)
{
eo_do(obj, simple_a_set(i));
}
eo_unref(obj);
}
static const Eo_Class *cur_klass;
2013-03-13 09:32:04 -07:00
static void
2014-04-23 01:23:39 -07:00
_a_set(Eo *obj, void *class_data EINA_UNUSED, int a)
2013-03-13 09:32:04 -07:00
{
eo_do_super(obj, cur_klass, simple_a_set(a));
}
static void
bench_eo_do_super(int request)
{
static Eo_Class_Description class_desc = {
EO_VERSION,
"Simple2",
EO_CLASS_TYPE_REGULAR,
2014-04-23 01:23:39 -07:00
EO_CLASS_DESCRIPTION_NOOPS(),
2013-03-13 09:32:04 -07:00
NULL,
0,
2014-04-23 01:23:39 -07:00
NULL,
2013-03-13 09:32:04 -07:00
NULL
};
cur_klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL);
int i;
Eo *obj = eo_add(cur_klass, NULL);
for (i = 0 ; i < request ; i++)
{
eo_do(obj, simple_a_set(i));
}
eo_unref(obj);
}
void eo_bench_eo_do(Eina_Benchmark *bench)
{
eina_benchmark_register(bench, "various",
EINA_BENCHMARK(bench_eo_do_general), 1000, 100000, 500);
2013-03-13 09:32:04 -07:00
eina_benchmark_register(bench, "super",
EINA_BENCHMARK(bench_eo_do_super), 1000, 100000, 500);
}