35 #define strlen(s1) ((int) strlen(s1)) 65 printf (
"Testing %s", test_name);
80 struct timeval end_time;
81 long long int elapsed_msec = 0;
83 gettimeofday (&end_time,
NULL);
85 elapsed_msec = (end_time.tv_usec -
start_time.tv_usec) / 1000;
86 elapsed_msec += (end_time.tv_sec -
start_time.tv_sec) * 1000;
88 printf (
" %s [%9.3f sec]\n",
"OK", (
float) elapsed_msec / 1000.0f);
96 printf (
" %s: %s\n",
"FAILED", message);
111 for (i = 0; i <
NOPS; i++)
123 error =
area_free (area_p, (
void *) entry);
147 for (idx = 0; idx <
NCACHES; idx++)
153 for (i = 0; i <
NOPS; i++)
155 if (entry[idx] !=
NULL)
157 error =
area_free (area_p, (
void *) entry[idx]);
166 if (entry[idx] ==
NULL)
179 if (entry[idx] !=
NULL)
181 error =
area_free (area_p, (
void *) entry[idx]);
212 for (idx = 0; idx <
NCACHES; idx++)
217 for (i = 0; i <
NOPS; i++)
220 if (entry[idx] !=
NULL)
222 error =
area_free (area_p, (
void *) entry[idx]);
231 if (entry[idx] ==
NULL)
237 for (idx = 0; idx <
NCACHES; idx++)
239 if (entry[idx] !=
NULL)
241 error =
area_free (area_p, (
void *) entry[idx]);
261 #define MAX_THREADS 64 274 return fail (
"too many threads");
283 return fail (
"area create fail");
287 for (i = 0; i < nthreads; i++)
289 if (pthread_create (&threads[i],
NULL, proc, (
void *) area) !=
NO_ERROR)
291 return fail (
"thread create");
295 for (i = 0; i < nthreads; i++)
299 pthread_join (threads[i], &retval);
302 return fail (
"thread proc error");
310 int i, j, blockset_cnt = 0, block_cnt = 0, chunk_count;
315 block = blockset->
items[
i];
320 for (j = 0; j < chunk_count; j++)
324 return fail (
"check bitmap status");
332 printf (
" Used %3d blocks(%2d blocksets). ", block_cnt, blockset_cnt);
357 {
"Value containers",
sizeof (
DB_VALUE), 1024}
365 {
"Set objects",
sizeof (
COL), 1024}
367 {
"Object list links",
sizeof (
DB_OBJLIST), 4096}
370 printf (
"============================================================\n");
371 printf (
"Test simple get/free entry:\n");
372 for (j = 0; j < (int) DIM (cubrid_infos); j++)
374 for (i = 1; i <= 64; i *= 2)
383 printf (
"============================================================\n");
384 printf (
"Test get/free entry with cache(32):\n");
385 for (j = 0; j < (int) DIM (cubrid_infos); j++)
387 for (i = 1; i <= 64; i *= 2)
396 printf (
"============================================================\n");
397 printf (
"Test get/free entry with cache(500), random access:\n");
398 for (j = 0; j < (int) DIM (cubrid_infos); j++)
400 for (i = 1; i <= 64; i *= 2)
415 {
"size 2", 50, 32 * 2}
417 {
"size 4", 50, 32 * 4}
419 {
"size 8", 50, 32 * 8}
421 {
"size 16", 50, 32 * 16}
423 {
"size 32", 50, 32 * 32}
425 {
"size 64", 50, 32 * 64}
427 {
"size 128", 50, 32 * 128}
430 printf (
"============================================================\n");
431 printf (
"Test simple get/free entry with different alloc count:\n");
432 for (i = 16; i <= 64; i *= 2)
434 for (j = 0; j < (int) DIM (diff_count_infos); j++)
449 printf (
"Unit tests failed!\n");
struct obj_tempassign OBJ_TEMPASSIGN
struct sm_template SM_TEMPLATE
static int test_area(AREA_CREATE_INFO *info, int nthreads, void *(*proc)(void *))
void area_destroy(AREA *area)
static void begin(char *test_name)
struct tp_domain TP_DOMAIN
static int fail(const char *message)
AREA_BLOCKSET_LIST * next
AREA * area_create(const char *name, size_t element_size, size_t alloc_count)
void * test_area_proc_2(void *param)
AREA_BLOCKSET_LIST * blockset_list
int main(int argc, char **argv)
struct obj_template OBJ_TEMPLATE
#define LF_BITFIELD_WORD_SIZE
static struct timeval start_time
#define CEIL_PTVDIV(dividend, divisor)
struct db_set DB_COLLECTION
static void error(const char *msg)
std::atomic< unsigned int > * bitfield
void * test_area_proc(void *param)
void * area_alloc(AREA *area)
int area_free(AREA *area, void *ptr)
AREA_BLOCK * items[AREA_BLOCKSET_SIZE]
void * test_area_proc_1(void *param)
struct db_objlist DB_OBJLIST