/* 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 . */ #include #include #include #include "eina_bench.h" #include "eina_mempool.h" typedef struct _Eina_Benchmark_Case Eina_Benchmark_Case; struct _Eina_Benchmark_Case { const char *bench_case; void (*build)(Eina_Benchmark *bench); }; static const Eina_Benchmark_Case etc[] = { { "Hash", eina_bench_hash }, { "Array vs List vs Inlist", eina_bench_array }, { "Stringshare", eina_bench_stringshare }, { "Convert", eina_bench_convert }, { NULL, NULL } }; int main(int argc, char **argv) { Eina_Module_Group *gp; Eina_Benchmark *test; Eina_Array *ea; unsigned int i; if (argc != 2) return -1; eina_benchmark_init(); for (i = 0; etc[i].bench_case != NULL; ++i) { test = eina_benchmark_new(etc[i].bench_case, argv[1]); if (!test) continue ; etc[i].build(test); ea = eina_benchmark_run(test); if (ea) { Eina_Array_Iterator it; char *tmp; unsigned int i; EINA_ARRAY_ITER_NEXT(ea, i, tmp, it) free(tmp); eina_array_free(ea); } eina_benchmark_free(test); } eina_mempool_init(); eina_module_root_add(PACKAGE_BUILD_DIR"/src/tests"); gp = eina_mempool_module_group_get(); eina_module_path_register(gp, PACKAGE_BUILD_DIR"/src/modules", EINA_TRUE); eina_bench_e17(); eina_mempool_shutdown(); eina_benchmark_shutdown(); return 0; }