Skip to content

Commit 675c32c

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
++
1 parent fc01815 commit 675c32c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

include/ipfixprobe/outputPlugin/outputStorage/allocationBuffer3.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ class AllocationBuffer3 : public AllocationBufferBase<ElementType> {
1919
explicit AllocationBuffer3(const std::size_t capacity, const uint8_t writersCount) noexcept
2020
: m_objectPool(capacity + writersCount * writersCount)
2121
{
22-
const std::size_t objectsPerWriter = m_objectPool.size() / writersCount;
22+
const std::size_t objectsPerQueue = m_objectPool.size() / m_queues.size();
2323
m_writersData.resize(writersCount);
2424
for (const std::size_t writerIndex : std::views::iota(0U, writersCount)) {
2525
m_writersData[writerIndex]->queueIndex = writerIndex;
26-
for (const auto elementIndex : std::views::iota(0U, objectsPerWriter)) {
27-
m_queues[writerIndex]->tryPush(
28-
m_objectPool.data() + writerIndex * objectsPerWriter + elementIndex);
26+
}
27+
for (const std::size_t queueIndex : std::views::iota(0U, m_queues.size())) {
28+
for (const std::size_t elementIndex : std::views::iota(0U, objectsPerQueue)) {
29+
m_queues[queueIndex]->tryPush(
30+
m_objectPool.data() + queueIndex * objectsPerQueue + elementIndex);
2931
}
3032
}
3133
}

0 commit comments

Comments
 (0)