@@ -1765,29 +1765,15 @@ struct WaitBackpressurePolicy {
17651765// / boilerplate which the user does not need to care about at top level.
17661766void DataProcessingDevice::handleData (ServiceRegistryRef ref, InputChannelInfo& info)
17671767{
1768+ using InputInfo = DataRelayer::InputInfo;
1769+ using InputType = DataRelayer::InputType;
1770+
17681771 auto & context = ref.get <DataProcessorContext>();
17691772 // This is the same id as the upper level function, so we get the events
17701773 // associated with the same interval. We will simply use "handle_data" as
17711774 // the category.
17721775 O2_SIGNPOST_ID_FROM_POINTER (cid, device, &info);
17731776
1774- enum struct InputType : int {
1775- Invalid = 0 ,
1776- Data = 1 ,
1777- SourceInfo = 2 ,
1778- DomainInfo = 3
1779- };
1780-
1781- struct InputInfo {
1782- InputInfo (size_t p, size_t s, InputType t)
1783- : position(p), size(s), type(t)
1784- {
1785- }
1786- size_t position;
1787- size_t size;
1788- InputType type;
1789- };
1790-
17911777 // This is how we validate inputs. I.e. we try to enforce the O2 Data model
17921778 // and we do a few stats. We bind parts as a lambda captured variable, rather
17931779 // than an input, because we do not want the outer loop actually be exposed
@@ -1804,8 +1790,8 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
18041790 results.reserve (parts.Size () / 2 );
18051791 size_t nTotalPayloads = 0 ;
18061792
1807- auto insertInputInfo = [&results, &nTotalPayloads](size_t position, size_t length, InputType type) {
1808- results.emplace_back (position, length, type);
1793+ auto insertInputInfo = [&results, &nTotalPayloads](size_t position, size_t length, InputType type, ChannelIndex index ) {
1794+ results.emplace_back (position, length, type, index );
18091795 if (type != InputType::Invalid && length > 1 ) {
18101796 nTotalPayloads += length - 1 ;
18111797 }
@@ -1817,24 +1803,24 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
18171803 if (sih) {
18181804 O2_SIGNPOST_EVENT_EMIT (device, cid, " handle_data" , " Got SourceInfoHeader with state %d" , (int )sih->state );
18191805 info.state = sih->state ;
1820- insertInputInfo (pi, 2 , InputType::SourceInfo);
1806+ insertInputInfo (pi, 2 , InputType::SourceInfo, info. id );
18211807 *context.wasActive = true ;
18221808 continue ;
18231809 }
18241810 auto dih = o2::header::get<DomainInfoHeader*>(headerData);
18251811 if (dih) {
1826- insertInputInfo (pi, 2 , InputType::DomainInfo);
1812+ insertInputInfo (pi, 2 , InputType::DomainInfo, info. id );
18271813 *context.wasActive = true ;
18281814 continue ;
18291815 }
18301816 auto dh = o2::header::get<DataHeader*>(headerData);
18311817 if (!dh) {
1832- insertInputInfo (pi, 0 , InputType::Invalid);
1818+ insertInputInfo (pi, 0 , InputType::Invalid, info. id );
18331819 O2_SIGNPOST_EVENT_EMIT_ERROR (device, cid, " handle_data" , " Header is not a DataHeader?" );
18341820 continue ;
18351821 }
18361822 if (dh->payloadSize > parts.At (pi + 1 )->GetSize ()) {
1837- insertInputInfo (pi, 0 , InputType::Invalid);
1823+ insertInputInfo (pi, 0 , InputType::Invalid, info. id );
18381824 O2_SIGNPOST_EVENT_EMIT_ERROR (device, cid, " handle_data" , " DataHeader payloadSize mismatch" );
18391825 continue ;
18401826 }
@@ -1847,14 +1833,14 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
18471833 O2_SIGNPOST_START (parts, pid, " parts" , " Processing DataHeader with splitPayloadParts %d and splitPayloadIndex %d" , dh->splitPayloadParts , dh->splitPayloadIndex );
18481834 }
18491835 if (!dph) {
1850- insertInputInfo (pi, 2 , InputType::Invalid);
1836+ insertInputInfo (pi, 2 , InputType::Invalid, info. id );
18511837 O2_SIGNPOST_EVENT_EMIT_ERROR (device, cid, " handle_data" , " Header stack does not contain DataProcessingHeader" );
18521838 continue ;
18531839 }
18541840 if (dh->splitPayloadParts > 0 && dh->splitPayloadParts == dh->splitPayloadIndex ) {
18551841 // this is indicating a sequence of payloads following the header
18561842 // FIXME: we will probably also set the DataHeader version
1857- insertInputInfo (pi, dh->splitPayloadParts + 1 , InputType::Data);
1843+ insertInputInfo (pi, dh->splitPayloadParts + 1 , InputType::Data, info. id );
18581844 pi += dh->splitPayloadParts - 1 ;
18591845 } else {
18601846 // We can set the type for the next splitPayloadParts
@@ -1864,12 +1850,12 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
18641850 size_t finalSplitPayloadIndex = pi + (dh->splitPayloadParts > 0 ? dh->splitPayloadParts : 1 ) * 2 ;
18651851 if (finalSplitPayloadIndex > parts.Size ()) {
18661852 O2_SIGNPOST_EVENT_EMIT_ERROR (device, cid, " handle_data" , " DataHeader::splitPayloadParts invalid" );
1867- insertInputInfo (pi, 0 , InputType::Invalid);
1853+ insertInputInfo (pi, 0 , InputType::Invalid, info. id );
18681854 continue ;
18691855 }
1870- insertInputInfo (pi, 2 , InputType::Data);
1856+ insertInputInfo (pi, 2 , InputType::Data, info. id );
18711857 for (; pi + 2 < finalSplitPayloadIndex; pi += 2 ) {
1872- insertInputInfo (pi + 2 , 2 , InputType::Data);
1858+ insertInputInfo (pi + 2 , 2 , InputType::Data, info. id );
18731859 }
18741860 }
18751861 }
@@ -1941,6 +1927,7 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
19411927 };
19421928 auto relayed = relayer.relay (parts.At (headerIndex)->GetData (),
19431929 &parts.At (headerIndex),
1930+ input,
19441931 nMessages,
19451932 nPayloadsPerHeader,
19461933 onDrop);
0 commit comments