Lines Matching refs:head
304 struct mem_alloc_head head; in mem_alloc_test() local
311 rt_list_init(&head.list); in mem_alloc_test()
312 head.count = 0; in mem_alloc_test()
313 head.start = rt_tick_get(); in mem_alloc_test()
314 head.end = rt_tick_get() + rt_tick_from_millisecond(MEM_RANG_ALLOC_TEST_TIME * 1000); in mem_alloc_test()
315 head.interval = (head.end - head.start) / 20; in mem_alloc_test()
324 while (head.end - head.start < RT_TICK_MAX / 2) in mem_alloc_test()
326 if (rt_tick_get() - head.start >= head.interval) in mem_alloc_test()
328 head.start = rt_tick_get(); in mem_alloc_test()
339 if (head.count == 0) in mem_alloc_test()
343 size = head.count / 2; in mem_alloc_test()
344 while (size != head.count) in mem_alloc_test()
346 ctx = rt_list_first_entry(&head.list, struct mem_alloc_context, node); in mem_alloc_test()
357 head.count --; in mem_alloc_test()
373 rt_list_insert_after(&head.list, &ctx->node); in mem_alloc_test()
374 head.count += 1; in mem_alloc_test()
378 if (!rt_list_isempty(&head.list)) in mem_alloc_test()
380 ctx = rt_list_first_entry(&head.list, struct mem_alloc_context, node); in mem_alloc_test()
391 head.count --; in mem_alloc_test()
395 while (!rt_list_isempty(&head.list)) in mem_alloc_test()
397 ctx = rt_list_first_entry(&head.list, struct mem_alloc_context, node); in mem_alloc_test()
408 head.count --; in mem_alloc_test()
410 uassert_int_equal(head.count, 0); in mem_alloc_test()
439 struct mem_realloc_head head; in mem_realloc_test() local
449 head.ctx_tab = RT_NULL; in mem_realloc_test()
450 head.count = size; in mem_realloc_test()
451 head.start = rt_tick_get(); in mem_realloc_test()
452 head.end = rt_tick_get() + rt_tick_from_millisecond(MEM_RANG_ALLOC_TEST_TIME * 1000); in mem_realloc_test()
453 head.interval = (head.end - head.start) / 20; in mem_realloc_test()
462 size = head.count * sizeof(struct mem_realloc_context *); in mem_realloc_test()
463 head.ctx_tab = rt_smem_alloc(&heap->parent, size); in mem_realloc_test()
464 uassert_not_null(head.ctx_tab); in mem_realloc_test()
465 rt_memset(head.ctx_tab, 0, size); in mem_realloc_test()
467 while (head.end - head.start < RT_TICK_MAX / 2) in mem_realloc_test()
469 if (rt_tick_get() - head.start >= head.interval) in mem_realloc_test()
471 head.start = rt_tick_get(); in mem_realloc_test()
476 idx = rand() % head.count; in mem_realloc_test()
477 ctx = rt_smem_realloc(&heap->parent, head.ctx_tab[idx], size); in mem_realloc_test()
482 if (head.ctx_tab[idx]) in mem_realloc_test()
484 head.ctx_tab[idx] = RT_NULL; in mem_realloc_test()
489 for (idx = 0; idx < head.count; idx++) in mem_realloc_test()
491 ctx = head.ctx_tab[idx]; in mem_realloc_test()
504 head.ctx_tab[idx] = RT_NULL; in mem_realloc_test()
511 if (head.ctx_tab[idx] != RT_NULL) in mem_realloc_test()
540 head.ctx_tab[idx] = ctx; in mem_realloc_test()
543 for (idx = 0; idx < head.count; idx++) in mem_realloc_test()
545 ctx = head.ctx_tab[idx]; in mem_realloc_test()
560 head.ctx_tab[idx] = RT_NULL; in mem_realloc_test()