File tree Expand file tree Collapse file tree
include/ipfixprobe/outputPlugin/outputStorage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,13 +19,14 @@ 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;
2223 m_writersData.resize (writersCount);
23- for (auto && [queue, objects] : std::views::zip (
24- m_queues,
25- m_objectPool | std::views::chunk (m_objectPool. size () / writersCount) )) {
26- std::ranges::for_each (objects, [&queue](ElementType& element) {
27- queue. get (). tryPush (&element );
28- });
24+ for (const std:: size_t writerIndex : std::views::iota ( 0U , writersCount)) {
25+ 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 );
29+ }
2930 }
3031 }
3132
@@ -95,7 +96,9 @@ class AllocationBuffer3 : public AllocationBufferBase<ElementType> {
9596 void unlock () noexcept { lock.clear (std::memory_order_release); }
9697 };
9798
98- struct WriterData {};
99+ struct WriterData {
100+ uint16_t queueIndex;
101+ };
99102
100103 std::vector<ElementType> m_objectPool;
101104 std::vector<CacheAlligned<WriterData>> m_writersData;
Original file line number Diff line number Diff line change @@ -45,9 +45,9 @@ class OutputStorageWriter {
4545
4646 void push (ElementType element) noexcept
4747 {
48- /* if (m_currentContainer->getData().storage.size() != 0) {
48+ if (m_currentContainer->getData ().storage .size () != 0 ) {
4949 throw std::runtime_error (" ZZZ" );
50- }*/
50+ }
5151 m_currentContainer.getData ().storage .emplace_back (std::move (element));
5252 if (m_currentContainer.getData ().storage .size () == OutputContainer<ElementType>::SIZE ) {
5353 // m_currentContainer.getData().written = true;
You can’t perform that action at this time.
0 commit comments