// // Created by lenovo on 22-09-2022. // #include "benchMark_pmemkv.h" MemoryMappedPMemKV::MemoryMappedPMemKV(int size,const std::string& fname) { number_of_records = size; fileName = fname; benchMarkType = "mmapPmemKV"; pmemkv_insert_time_micro = 0; pmemkv_read_time_micro = 0; pmemkv_single_delete_time_micro = 0; pmemkv_all_delete_time_micro = 0; _dbPtr = NULL; } MemoryMappedPMemKV::~MemoryMappedPMemKV() { } void MemoryMappedPMemKV::openFile() { config cfg; cfg.put_size(SIZE); cfg.put_path(fileName); cfg.put_create_if_missing(true); _dbPtr = std::make_unique(); _dbPtr->open("cmap", std::move(cfg)); } void MemoryMappedPMemKV::WriteMemoryMMAP(const std::vector& vec) { for(int i=0; iput( to_string(i), to_string(vec[i])); } } void MemoryMappedPMemKV::ReadMemoryMMAP() { std::string value; for(int i=0; i < number_of_records ; i++) { _dbPtr->get(to_string(i), &value); } } void MemoryMappedPMemKV::eraseData(const std::string& key) { _dbPtr->remove(key); } void MemoryMappedPMemKV::eraseDataALL() { std::string value; for(int i=0; i < number_of_records; i++) { _dbPtr->remove(to_string(i)); } } void MemoryMappedPMemKV::displayResults() { std::cout<<"mmap impelementation type :"<