Commit b5544d67 authored by Matthieu Dorier's avatar Matthieu Dorier

modified benchmark to allow not to reuse the buffer in GET operations

parent 2e885cf5
...@@ -223,12 +223,15 @@ class GetBenchmark : public AbstractAccessBenchmark { ...@@ -223,12 +223,15 @@ class GetBenchmark : public AbstractAccessBenchmark {
std::vector<std::string> m_keys; std::vector<std::string> m_keys;
std::vector<std::string> m_vals; std::vector<std::string> m_vals;
bool m_reuse_buffer = false;
public: public:
template<typename ... T> template<typename ... T>
GetBenchmark(T&& ... args) GetBenchmark(Json::Value& config, T&& ... args)
: AbstractAccessBenchmark(std::forward<T>(args)...) {} : AbstractAccessBenchmark(config, std::forward<T>(args)...) {
m_reuse_buffer = config.get("reuse-buffer", false).asBool();
}
virtual void setup() override { virtual void setup() override {
// generate key/value pairs and store them in the local // generate key/value pairs and store them in the local
...@@ -252,11 +255,18 @@ class GetBenchmark : public AbstractAccessBenchmark { ...@@ -252,11 +255,18 @@ class GetBenchmark : public AbstractAccessBenchmark {
virtual void execute() override { virtual void execute() override {
// execute GET operations // execute GET operations
auto& db = remoteDatabase(); auto& db = remoteDatabase();
std::string val(m_val_size_range.second-1, 0); std::string val;
if(m_reuse_buffer)
val.resize(m_val_size_range.second-1, 0);
else
val.resize((m_val_size_range.second-1)*m_num_entries, 0);
size_t offset = 0;
for(unsigned i=0; i < m_num_entries; i++) { for(unsigned i=0; i < m_num_entries; i++) {
auto& key = m_keys[i]; auto& key = m_keys[i];
db.get(key, val); hg_size_t vsize = m_val_size_range.second-1;
val.resize(m_val_size_range.second-1, 0); db.get((const void*)key.data(), key.size(), (void*)(val.data() + offset), &vsize);
if(!m_reuse_buffer)
offset += m_val_size_range.second-1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment