Commit 30a0a459 authored by Matthieu Dorier's avatar Matthieu Dorier

slight changes in WriteBatchImpl

parent 4df770f2
......@@ -55,6 +55,7 @@ class WriteBatchImpl {
void update_keyval_statistics(size_t ksize, size_t vsize) {
if(!m_stats) return;
std::lock_guard<tl::mutex> g(m_stats_mtx);
m_stats->key_sizes.updateWith(ksize);
if(vsize)
m_stats->value_sizes.updateWith(vsize);
......@@ -62,6 +63,7 @@ class WriteBatchImpl {
void update_operation_statistics(size_t batch_size) {
if(!m_stats) return;
std::lock_guard<tl::mutex> g(m_stats_mtx);
m_stats->batch_sizes.updateWith(batch_size);
}
......@@ -158,7 +160,7 @@ class WriteBatchImpl {
// find the queue of batches
std::queue<keyvals>& entry_queue = m_entries[&db];
if(entry_queue.empty()
|| entry_queue.back().m_packed_key_sizes.size() >= m_max_batch_size) {
|| entry_queue.back().m_size >= m_max_batch_size) {
entry_queue.emplace();
}
auto& kv_batch = entry_queue.back();
......@@ -207,7 +209,7 @@ class WriteBatchImpl {
auto& kvs_queue = m_entries[&db];
if(kvs_queue.empty()
|| kvs_queue.back().m_packed_key_sizes.size() >= m_max_batch_size) {
|| kvs_queue.back().m_size >= m_max_batch_size) {
kvs_queue.emplace();
}
auto& kv_batch = kvs_queue.back();
......
......@@ -24,6 +24,7 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
{
hepnos::WriteBatch batch(async_engine);
batch.activateStatistics();
for(auto i = 0; i < 5; i++) {
auto run = dataset.createRun(batch, i);
......@@ -31,6 +32,9 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
CPPUNIT_ASSERT(run.store(batch, key1, out_obj_b));
}
batch.flush();
hepnos::WriteBatchStatistics stats;
batch.collectStatistics(stats);
std::cout << stats << std::endl;
}
async_engine.wait(); // useless, but just to test
{
......
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