Skip to content

Commit 6d4285c

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
++
1 parent d23f8d6 commit 6d4285c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎include/ipfixprobe/outputPlugin/outputStorage/ffqOutputStorage.hpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class FFQOutputStorage : public OutputStorage<ElementType> {
2929
while (true) {
3030
const uint64_t writeRank = this->m_writeRank->fetch_add(1, std::memory_order_acq_rel);
3131
const uint64_t writeIndex = writeRank % OutputStorage<ElementType>::STORAGE_CAPACITY;
32+
__builtin_prefetch(
33+
&this->m_storage[writeIndex + this->m_writersCount.load(std::memory_order_relaxed)],
34+
PrefetchMode::Write,
35+
Locality::High);
3236
if (m_cells[writeIndex].state.isRead() && m_cells[writeIndex].state.tryToSetWriter()) {
3337
this->m_storage[writeIndex].assign(
3438
container,
@@ -51,6 +55,11 @@ class FFQOutputStorage : public OutputStorage<ElementType> {
5155
while (!finished()) {
5256
const uint64_t readRank = m_readRank->fetch_add(1, std::memory_order_acq_rel);
5357
const uint64_t readIndex = readRank % OutputStorage<ElementType>::STORAGE_CAPACITY;
58+
59+
__builtin_prefetch(
60+
&this->m_storage[readIndex + this->m_readersCount.load(std::memory_order_relaxed)],
61+
PrefetchMode::Read,
62+
Locality::High);
5463
if (m_cells[readIndex].state.tryToSetReadingStarted()) {
5564
m_readersData[readerIndex]->lastReadIndex = readIndex;
5665
return &this->m_storage[readIndex].getData();

0 commit comments

Comments
 (0)