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

Use wall time in throughput test #227

Merged
merged 4 commits into from
Dec 21, 2023

Conversation

jean-roland
Copy link
Contributor

Throughput test had the same issue of using system time instead of wall time as #184.

This PR switch this to wall time using CLOCK_MONOTONIC.

@Mallets
Copy link
Member

Mallets commented Dec 20, 2023

I think the throughput tests should use the z_time_* primitives we already have.
Similarly as done in https://github.com/eclipse-zenoh/zenoh-pico/pull/269/files.

@jean-roland
Copy link
Contributor Author

Agreed but that won't be possible until #183 has been addressed sadly.

@Mallets
Copy link
Member

Mallets commented Dec 20, 2023

My bad... I've mistaken zenoh-c with zenoh-pico repository :)

@jean-roland
Copy link
Contributor Author

jean-roland commented Dec 20, 2023

Ok it breaks windows build because of course. So either we resolve #183 before merging this or we resort to the z_ping trick:

    if(NOT(UNIX) AND(${target} STREQUAL "z_ping" OR ${target} STREQUAL "z_pong"))
        continue()
    endif()

return stats;
}

static inline unsigned long elapsed_us(const struct timespec *start, const struct timespec *end) {
Copy link
Member

Choose a reason for hiding this comment

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

It may be better to immediately return floating point seconds than to convert them further each time at the risk of making a mistake with the number of zeros.

stats->finished_rounds++;
printf("%f msg/s\n", N * (double)CLOCKS_PER_SEC / (double)(stats->stop - stats->start));
printf("%f msg/s\n", (double)N * 1000000.0 / (double)elapsed_us(&stats->start, &end));
Copy link
Member

Choose a reason for hiding this comment

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

And we also don’t need type conversion every time

Copy link
Member

@sashacmc sashacmc left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@milyin milyin merged commit 67428d7 into eclipse-zenoh:master Dec 21, 2023
4 checks passed
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.

4 participants