// // Created by lenovo on 27-09-2022. // #ifndef PRACTICEPROGRAM_BENCHMARK_PMEMKV_H #define PRACTICEPROGRAM_BENCHMARK_PMEMKV_H #include #include #include #include #include #include #include #include #define ASSERT(expr) \ do { \ if (!(expr)) \ puts(pmemkv_errormsg()); \ assert(expr); \ } while (0) #define LOG(msg) puts(msg) using namespace std; using namespace pmem::kv; const uint64_t SIZE = 1024UL * 1024UL * 1024UL; class MemoryMappedPMemKV { public: std::string benchMarkType; std::string fileName; size_t number_of_records; size_t pmemkv_insert_time_micro; size_t pmemkv_read_time_micro; size_t pmemkv_single_delete_time_micro; size_t pmemkv_all_delete_time_micro; MemoryMappedPMemKV(int size,const std::string& fname); ~MemoryMappedPMemKV(); void openFile(); void WriteMemoryMMAP(const std::vector& vec); void ReadMemoryMMAP(); void eraseData(const std::string &key); void eraseDataALL(); void displayResults(); private: std::unique_ptr _dbPtr; status s; }; #endif //PRACTICEPROGRAM_BENCHMARK_PMEMKV_H