Skip to content

Commit 2142176

Browse files
Better information in error message (#7921)
Minor update of benchmark_ExternalFairMQDeviceProxies
1 parent a3a8ce4 commit 2142176

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

Framework/Core/test/benchmark_ExternalFairMQDeviceProxies.cxx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,21 @@ std::vector<DataProcessorSpec> defineDataProcessing(ConfigContext const& config)
287287
FairMQParts messages;
288288
size_t nHeaders = 0;
289289
size_t totalPayload = 0;
290-
auto insertHeader = [&dph, &channelAlloc, &messages, &nHeaders](DataHeader const& dh) -> void {
291-
FairMQMessagePtr header = o2::pmr::getMessage(Stack{channelAlloc, dh, dph});
290+
size_t allocatedSize = 0;
291+
auto createMessage = [&transport, &allocatedSize](size_t size) -> FairMQMessagePtr {
292+
auto msg = transport->CreateMessage(size);
293+
allocatedSize += size;
294+
return msg;
295+
};
296+
auto insertHeader = [&dph, &createMessage, &messages, &nHeaders](DataHeader const& dh) -> void {
297+
Stack stack{dh, dph};
298+
FairMQMessagePtr header = createMessage(stack.size());
299+
memcpy(header->GetData(), stack.data(), stack.size());
292300
messages.AddPart(std::move(header));
293301
++nHeaders;
294302
};
295-
auto insertPayload = [&transport, &messages, &totalPayload](size_t size) -> void {
296-
FairMQMessagePtr payload = transport->CreateMessage(size);
303+
auto insertPayload = [&createMessage, &messages, &totalPayload](size_t size) -> void {
304+
FairMQMessagePtr payload = createMessage(size);
297305
messages.AddPart(std::move(payload));
298306
totalPayload += size;
299307
};
@@ -344,7 +352,7 @@ std::vector<DataProcessorSpec> defineDataProcessing(ConfigContext const& config)
344352
if (std::string(e.what()).find("shmem: could not create a message of size") == std::string::npos) {
345353
throw e;
346354
}
347-
LOG(error) << fmt::format("Exception {}\nconsider increasing shared memory", e.what());
355+
LOG(error) << fmt::format("Exception {}\nallocated {} in cycle {} \nconsider increasing shared memory", e.what(), allocatedSize, attributes->iteration);
348356
forcedTermination = true;
349357
}
350358
++attributes->iteration;

0 commit comments

Comments
 (0)