Skip to content

Commit 2722320

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
++
1 parent 76f300e commit 2722320

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

include/ipfixprobe/outputPlugin/outputStorage/b2OutputStorage.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ class B2OutputStorage : public BOutputStorage<ElementType> {
112112
typename BOutputStorage<ElementType>::ReaderData& readerData
113113
= this->m_readersData[readerIndex].get();
114114
if (readerData.bucketAllocation.containersLeft()) {
115+
__builtin_prefetch(
116+
&this->getNextElement(readerData.bucketAllocation).getData() + 1,
117+
PrefetchMode::Read,
118+
Locality::High);
115119
return &this->getNextElement(readerData.bucketAllocation).getData();
116120
}
117121

@@ -120,7 +124,10 @@ class B2OutputStorage : public BOutputStorage<ElementType> {
120124
BackoffScheme backoffScheme(0, std::numeric_limits<std::size_t>::max());
121125
do {
122126
const bool overflowed = readerData.shift(this->m_expectedReadersCount, readerIndex);
123-
127+
__builtin_prefetch(
128+
&this->m_buckets[readerData.readPosition + this->m_expectedReadersCount],
129+
PrefetchMode::Write,
130+
Locality::Medium);
124131
if (overflowed) {
125132
if (!this->writersPresent()) {
126133
readerData.generation.fetch_add(1, std::memory_order_release);

include/ipfixprobe/outputPlugin/outputStorage/outputStorage.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
namespace ipxp::output {
2121

22+
enum class PrefetchMode : int { Read = 0, Write = 1 };
23+
24+
enum class Locality : int { None = 0, Low = 1, Medium = 2, High = 3 };
25+
2226
constexpr std::size_t remap(const std::size_t index) noexcept
2327
{
2428
/*if (index > std::numeric_limits<uint16_t>::max()) {

0 commit comments

Comments
 (0)