22 #define DELETE_LOOP_SLEEP_TIME 5000 // 5 milli secs
23 #define MOVE_LOOP_SLEEP_TIME 5000 // 5 milli secs
24 #define MAIN_LOOP_SLEEP_TIME 10000 // 5 milli secs
43 for(
int i=0; i<size-1; i++) {
44 printf(
"%d, ", arr[i]);
46 printf(
"%d\n", arr[size-1]);
50 int idx = *((
int*)req->data);
55 printf(
"Move from DRAM to NVRAM: %d at [%ld ms]\n", idx, (uv_hrtime() / 1000000) % 100000);
66 int idx = *((
int*)req->data);
71 printf(
"Move from NVRAM to DRAM: %d at [%ld ms]\n", idx, (uv_hrtime() / 1000000) % 100000);
82 int idx = *((
int*)req->data);
86 printf(
"Delete from DRAM: %d at [%ld ms]\n", idx, (uv_hrtime() / 1000000) % 100000);
93 int idx = *((
int*)req->data);
97 printf(
"Delete from NVRAM: %d at [%ld ms]\n", idx, (uv_hrtime() / 1000000) % 100000);
110 printf(
"on_logistics_timer [%ld ms]\n", (timestamp / 1000000) % 100000);
111 uv_work_t* work_req = (uv_work_t*)malloc(
sizeof(*work_req));
113 work_req->data = malloc(
sizeof(
int));
114 *((
int *)(work_req->data)) = rand() %
ARRAY_SIZE;
118 work_req->data = malloc(
sizeof(
int));
119 *((
int *)(work_req->data)) = rand() %
ARRAY_SIZE;
127 printf(
"on_deletion_timer [%ld ms]\n", (timestamp / 1000000) % 100000);
128 uv_work_t* work_req = (uv_work_t*)malloc(
sizeof(*work_req));
130 work_req->data = malloc(
sizeof(
int));
131 *((
int *)(work_req->data)) = rand() %
ARRAY_SIZE;
136 work_req->data = malloc(
sizeof(
int));
137 *((
int *)(work_req->data)) = rand() %
ARRAY_SIZE;
145 uv_loop_t *thread_loop = (uv_loop_t *) data;
146 fprintf(stderr,
"Logistics thread will start event loop\n");
148 uv_timer_t timer_logistics;
149 uv_timer_init(thread_loop, &timer_logistics);
153 uv_run(thread_loop, UV_RUN_DEFAULT);
158 uv_loop_t *thread_loop = (uv_loop_t *) data;
159 fprintf(stderr,
"Delete thread will start event loop\n");
161 uv_timer_t timer_deletion;
162 uv_timer_init(thread_loop, &timer_deletion);
166 uv_run(thread_loop, UV_RUN_DEFAULT);
196 pthread_t logistics_thread, deletion_thread;
198 uv_loop_t *logistics_loop = uv_loop_new();
201 uv_loop_t *deletion_loop = uv_loop_new();
208 printf(
"==========================================\n");
210 printf(
"------------------------------------------\n");
212 printf(
"==========================================\n");
224 nanosleep(&ts,
NULL);