|
23 | 23 | #include "buf0dblwr.h" |
24 | 24 |
|
25 | 25 |
|
| 26 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 27 | +static uint64_t PMEM_SIM_LATENCY = 1000; |
| 28 | +static float PMEM_CPU_FREQ = 2.2; |
| 29 | +static uint64_t PMEM_SIM_CPU_CYCLES = PMEM_SIM_LATENCY * PMEM_CPU_FREQ; |
| 30 | +#endif //UNIV_PMEM_SIM_LATENCY |
| 31 | + |
26 | 32 | #if defined (UNIV_PMEMOBJ_BUF) |
27 | 33 | /* |
28 | 34 | There are two types of structure need to be allocated: structures in NVM that non-volatile after shutdown server or power-off and D-RAM structures that only need when the server is running. |
@@ -733,6 +739,11 @@ TX_BEGIN(pop) { |
733 | 739 | //pspec_block->file_handle = node->handle; |
734 | 740 | strcpy(pspec_block->file_name, node->name); |
735 | 741 |
|
| 742 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 743 | + /*5 times write to NVM*/ |
| 744 | + PMEM_DELAY(start_cycle, end_cycle, 5 * pmw->PMEM_SIM_CPU_CYCLES); |
| 745 | +#endif |
| 746 | + |
736 | 747 | #if defined (UNIV_PMEMOBJ_NO_PERSIST) |
737 | 748 | pmemobj_memcpy_persist(pop, pdata + pspec_block->pmemaddr, src_data, page_size); |
738 | 749 | //memcpy(pdata + pspec_block->pmemaddr, src_data, page_size); |
@@ -830,6 +841,10 @@ TX_BEGIN(pop) { |
830 | 841 | } |
831 | 842 | } |
832 | 843 | pfree_block->sync = sync; |
| 844 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 845 | + /*3 times write to NVM*/ |
| 846 | + PMEM_DELAY(start_cycle, end_cycle, 3 * pmw->PMEM_SIM_CPU_CYCLES); |
| 847 | +#endif |
833 | 848 | #if defined (UNIV_PMEMOBJ_NO_PERSIST) |
834 | 849 | pmemobj_memcpy_persist(pop, pdata + pfree_block->pmemaddr, src_data, page_size); |
835 | 850 | //memcpy(pdata + pfree_block->pmemaddr, src_data, page_size); |
@@ -923,6 +938,10 @@ TX_BEGIN(pop) { |
923 | 938 | else |
924 | 939 | ++(phashlist->n_sio_pending); |
925 | 940 |
|
| 941 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 942 | + /*7 times write to NVM*/ |
| 943 | + PMEM_DELAY(start_cycle, end_cycle, 7 * pmw->PMEM_SIM_CPU_CYCLES); |
| 944 | +#endif |
926 | 945 | // HANDLE FULL LIST //////////////////////////////////////////////////////////// |
927 | 946 | if (phashlist->cur_pages >= phashlist->max_pages * PMEM_BUF_FLUSH_PCT) { |
928 | 947 | //(3) The hashlist is (nearly) full, flush it and assign a free list |
@@ -1303,6 +1322,10 @@ pm_handle_finished_block( |
1303 | 1322 | for (i = 0; i < pflush_list->max_pages; i++) { |
1304 | 1323 | D_RW(D_RW(pflush_list->arr)[i])->state = PMEM_FREE_BLOCK; |
1305 | 1324 | D_RW(D_RW(pflush_list->arr)[i])->sync = false; |
| 1325 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 1326 | + /*2 times write to NVM*/ |
| 1327 | + PMEM_DELAY(start_cycle, end_cycle, 2 * pmw->PMEM_SIM_CPU_CYCLES); |
| 1328 | +#endif |
1306 | 1329 | } |
1307 | 1330 |
|
1308 | 1331 | pflush_list->cur_pages = 0; |
@@ -1336,11 +1359,20 @@ pm_handle_finished_block( |
1336 | 1359 | PMEM_BUF_FREE_POOL* pfree_pool; |
1337 | 1360 | pfree_pool = D_RW(buf->free_pool); |
1338 | 1361 |
|
| 1362 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 1363 | + /*7 times write to NVM*/ |
| 1364 | + PMEM_DELAY(start_cycle, end_cycle, 7 * pmw->PMEM_SIM_CPU_CYCLES); |
| 1365 | +#endif |
| 1366 | + |
1339 | 1367 | //printf("PMEM_DEBUG: in fil_aio_wait(), try to lock free_pool list id: %zd, cur_lists in free_pool= %zd \n", pflush_list->list_id, pfree_pool->cur_lists); |
1340 | 1368 | pmemobj_rwlock_wrlock(pop, &pfree_pool->lock); |
1341 | 1369 |
|
1342 | 1370 | POBJ_LIST_INSERT_TAIL(pop, &pfree_pool->head, flush_list, list_entries); |
1343 | 1371 | pfree_pool->cur_lists++; |
| 1372 | +#if defined (UNIV_PMEM_SIM_LATENCY) |
| 1373 | + /*2 times write to NVM*/ |
| 1374 | + PMEM_DELAY(start_cycle, end_cycle, 2 * pmw->PMEM_SIM_CPU_CYCLES); |
| 1375 | +#endif |
1344 | 1376 | //wakeup who is waitting for free_pool available |
1345 | 1377 | os_event_set(buf->free_pool_event); |
1346 | 1378 |
|
@@ -1583,7 +1615,7 @@ pm_buf_read( |
1583 | 1615 |
|
1584 | 1616 | #if defined (UNIV_PMEMOBJ_BLOOM) |
1585 | 1617 | if (bloom_ret == BLOOM_MAY_EXIST){ |
1586 | | - printf("++++> BLOOM false positive fold %zu \n", page_id.fold()); |
| 1618 | + //printf("++++> BLOOM false positive fold %zu \n", page_id.fold()); |
1587 | 1619 | buf->cbf->n_false_pos_reads++; |
1588 | 1620 | } |
1589 | 1621 | #endif |
|
0 commit comments