Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demos: extend benchmark demo by can and ethernet #164

Merged
merged 11 commits into from
Jan 13, 2025
Prev Previous commit
Next Next commit
minor changes
  • Loading branch information
VJonasHolley committed Jan 7, 2025
commit 72c5f9aa7950aae61c07aa16010063fc0578d0a5
14 changes: 6 additions & 8 deletions Demos/Benchmark/BenchmarkDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void SendEthernetFrames(IEthernetController* ethernetController, uint32_t messag
for (uint32_t i = 0; i < messageCount; i++)
{
std::vector<uint8_t> frameData(messageSizeInBytes, '*');
ethernetController->SendFrame(std::move(EthernetFrame{frameData}));
ethernetController->SendFrame(EthernetFrame{frameData});
}
}

Expand Down Expand Up @@ -417,8 +417,9 @@ void ParticipantsThread(std::shared_ptr<SilKit::Config::IParticipantConfiguratio
ethernetController = participant->CreateEthernetController("Eth1", "Eth1");

ethernetController->AddFrameHandler(
[&messageCounter, participantName](IEthernetController* /*controller*/,
const EthernetFrameEvent& /*frameEvent*/) { messageCounter++; });
[&messageCounter](IEthernetController* /*controller*/, const EthernetFrameEvent& /*frameEvent*/) {
messageCounter++;
});

lifecycleService->SetCommunicationReadyHandler([ethernetController]() { ethernetController->Activate(); });
VJonasHolley marked this conversation as resolved.
Show resolved Hide resolved
break;
Expand All @@ -428,9 +429,7 @@ void ParticipantsThread(std::shared_ptr<SilKit::Config::IParticipantConfiguratio
canController = participant->CreateCanController("CAN1", "CAN1");

canController->AddFrameHandler(
[&messageCounter, participantName](ICanController* /*ctrl*/, const CanFrameEvent& /*frameEvent*/) {
messageCounter++;
});
[&messageCounter](ICanController* /*ctrl*/, const CanFrameEvent& /*frameEvent*/) { messageCounter++; });

lifecycleService->SetCommunicationReadyHandler([canController]() {
canController->SetBaudRate(10'000, 1'000'000, 2'000'000);
Expand Down Expand Up @@ -511,8 +510,7 @@ void PrintParameters(BenchmarkConfig benchmark)
<< std::endl
<< std::left << std::setw(39) << "- Number of participants: " << benchmark.numberOfParticipants
<< std::endl
<< std::left << std::setw(39) << "- Messages per simulation step: " << benchmark.messageCount
<< std::endl
<< std::left << std::setw(39) << "- Messages per simulation step: " << benchmark.messageCount << std::endl
<< std::left << std::setw(39) << "- Message size (bytes): " << benchmark.messageSizeInBytes << std::endl
<< std::left << std::setw(39) << "- Registry URI: " << benchmark.registryUri << std::endl
<< std::left << std::setw(39) << "- Configuration: " << benchmark.silKitConfigPath << std::endl
Expand Down
Loading