-
Notifications
You must be signed in to change notification settings - Fork 57
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
Conversation
I think the throughput tests should use the |
Agreed but that won't be possible until #183 has been addressed sadly. |
My bad... I've mistaken |
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() |
examples/z_sub_thr.c
Outdated
return stats; | ||
} | ||
|
||
static inline unsigned long elapsed_us(const struct timespec *start, const struct timespec *end) { |
There was a problem hiding this comment.
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.
examples/z_sub_thr.c
Outdated
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
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
.