diff --git a/src/tests/mblock_benchmark.c b/src/tests/mblock_benchmark.c new file mode 100644 index 0000000..469e127 --- /dev/null +++ b/src/tests/mblock_benchmark.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2025 YuQing <384681@qq.com> + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the Lesser GNU General Public License, version 3 + * or later ("LGPL"), as published by the Free Software Foundation. + * + * This program 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. + * + * You should have received a copy of the Lesser GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "fastcommon/logger.h" +#include "fastcommon/shared_func.h" +#include "fastcommon/pthread_func.h" +#include "fastcommon/fast_mblock.h" + +static int thread_count = 2; +static int64_t loop_count = 10000000; +static struct fast_mblock_man mblock; + +static void *thread_run(void *args) +{ + int thread_index; + int i; + void *obj; + + thread_index = (long)args; + printf("thread #%d start\n", thread_index); + + for (i=0; i