BOOLEAN eoam_fsm_terminate(void) { /* stop low layer packet capture */ xdbg_log(XDBG_INFO, "eoam_fsm_terminate: stop dev"); eoam_cout_stop_rx(); xdbg_log(XDBG_INFO, "eoam_fsm_terminate: terminate ipc"); eoam_xipc_terminate(); /* FIXME:init order */ /* clost deve in final step */ xdbg_log(XDBG_INFO, "eoam_fsm_terminate: close dev"); eoam_cout_terminate(); xdbg_log(XDBG_INFO, "eoam_fsm_terminate: close log"); eoam_log_terminate(); #if 1 /* FIXNE:lib */ if (g_fsm_port != NULL) { xmem_free(g_fsm_port, sizeof(fsm_port_s) * (g_fsm_init_params.max_oam_ports+1)); } #endif return TRUE; }
int main(int argc, char** argv) { deal_with_test_count(argc, argv); pool = xmem_create_pool(sizeof(test_struct)); uint64_t total_start, alloc_start, free_start; total_start = alloc_start = rdtsc(); for(int i = 0; i < test_count; i++) { test_array[i] = (test_struct*)xmem_alloc(pool); } alloc_total = rdtsc() - alloc_start; free_start = rdtsc(); for(int i = 0; i < test_count; i++) { xmem_free(pool, (char*)test_array[i]); } free_total = rdtsc() - free_start; xmem_destroy_pool(pool); total = rdtsc() - total_start; printf("=== perf of xmem\n"); printf("alloc & free times: %d\n", test_count); printf("alloc time: %llu CPU cycles\n", alloc_total); printf("free time: %llu CPU cycles\n", free_total); printf("total time: %llu CPU cycles\n", total); return 0; }
int main() { pool = xmem_create_pool(sizeof(test_struct)); int total_start, alloc_start, free_start; total_start = alloc_start = rdtsc(); for(int i = 0; i < TEST_COUNT; i++) { test_array[i] = xmem_alloc(pool); } alloc_total = rdtsc() - alloc_start; free_start = rdtsc(); for(int i = 0; i < TEST_COUNT; i++) { xmem_free(pool, test_array[i]); } free_total = rdtsc() - free_start; xmem_destroy_pool(pool); total = rdtsc() - total_start; printf("=== perf of xmem\n"); printf("alloc & free times: %d\n", TEST_COUNT); printf("alloc time: %d CPU cycles\n", alloc_total); printf("free time: %d CPU cycles\n", free_total); printf("total time: %d CPU cycles\n", total); return 0; }