Skip to content

Conversation

@KerstinKeller
Copy link
Contributor

Description

Adapt benchmark, so that it runs for all three Pubsub Transportation types.
Remove the latency benchmark, as this is essentially tested by Send_Receive benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


#include <benchmark/benchmark.h>

#include <atomic>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'benchmark/benchmark.h' file not found [clang-diagnostic-error]

<benchmark/benchmark.h>
^

enum class TransportLayer : int
{
Shm = 0,
Udp = 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: enum 'TransportLayer' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]

um class TransportLayer : int
         ^

// Generate (payload_size, transport_layer) argument tuples.
static void TransportAndSizeArgs(benchmark::internal::Benchmark* b)
{
for (int layer = static_cast<int>(TransportLayer::Shm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'TransportAndSizeArgs' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]

 void TransportAndSizeArgs(benchmark::internal::Benchmark* b)
      ^

// Generate (payload_size, transport_layer) argument tuples.
static void TransportAndSizeArgs(benchmark::internal::Benchmark* b)
{
for (int layer = static_cast<int>(TransportLayer::Shm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: pointer parameter 'b' can be pointer to const [readability-non-const-parameter]

Suggested change
for (int layer = static_cast<int>(TransportLayer::Shm);
void TransportAndSizeArgs(const benchmark::internal::Benchmark* b)

}

// Benchmarked section: Send data
for (auto _ : state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion]

Suggested change
for (auto _ : state)
lay_ms));static_cast<int>(

ecal/benchmarks/pubsub/benchmark_pubsub.cpp:201:

- tSubscriberCount() > 0)
+ tSubscriberCount()) > 0)

void BM_eCAL_Send_and_Receive(benchmark::State& state)
{
const size_t payload_size = static_cast<size_t>(state.range(0));
const auto layer = static_cast<TransportLayer>(state.range(1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'convar' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

;
                               ^

void BM_eCAL_Send_and_Receive(benchmark::State& state)
{
const size_t payload_size = static_cast<size_t>(state.range(0));
const auto layer = static_cast<TransportLayer>(state.range(1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'msg_received' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

;
                                                                    ^

{
{
std::lock_guard<std::mutex> lock(mtx);
msg_received = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion]

Suggested change
msg_received = false;
gistration_delay_ms));
bscriberCount() static_cast<int>(> 0))

{
{
std::lock_guard<std::mutex> lock(mtx);
msg_received = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'size_t' (aka 'unsigned long') -> 'bool' [readability-implicit-bool-conversion]

Suggested change
msg_received = false;
gistration_delay_ms));
bscriberCount() 0) == 0u

BENCHMARK_MAIN();
// ------------------------------------------------------------------------

BENCHMARK_MAIN();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'BM_eCAL_Send_and_Receive' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

ARK(BM_eCAL_Send_and_Receive)
    ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants