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 @@ -27,12 +27,23 @@ class RingOutputStorage : public OutputStorage<ElementType> {
2727 expectedWritersCount > 1),
2828 &ipx_ring_destroy)
2929 {
30+ uint16_t index = 0 ;
31+ for (auto & writerData : m_writersData) {
32+ writerData->index = index++;
33+ }
3034 }
3135
3236 bool write (
3337 const Reference<OutputContainer<ElementType>>& container,
34- [[maybe_unused]] const uint8_t writerIndex) noexcept override
38+ const uint8_t writerIndex) noexcept override
3539 {
40+ WriterData& writerData = m_writersData[writerIndex].get ();
41+ this ->m_storage [writerData.index ].assign (
42+ container,
43+ this ->makeDeallocationCallback (writerIndex));
44+ writerData.index = (writerData.index + this ->m_expectedWritersCount )
45+ % OutputStorage<ElementType>::STORAGE_CAPACITY;
46+
3647 ipx_ring_push (m_ring.get (), container.getCounter ());
3748 return true ;
3849 }
@@ -62,6 +73,13 @@ class RingOutputStorage : public OutputStorage<ElementType> {
6273 }
6374
6475private:
76+ struct WriterData {
77+ uint16_t index;
78+ };
79+
80+ std::array<CacheAlligned<WriterData>, OutputStorage<ElementType>::MAX_WRITERS_COUNT>
81+ m_writersData;
82+
6583 std::unique_ptr<ipx_ring_t , decltype (&ipx_ring_destroy)> m_ring;
6684 OutputContainer<ElementType> m_container;
6785};
You can’t perform that action at this time.
0 commit comments