-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests: add some benchmarks #7786
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
Conversation
c73f05e
to
e68e70a
Compare
tests/bench_ctx_switch/main.c
Outdated
xtimer_t timer; | ||
timer.callback = _timer_callback; | ||
|
||
unsigned n = 0; |
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.
wondering: could this lead to overflows on 16-bit platforms? I would imagine a decently fast clocked msp430 can do more than 65k context switches per s, right?
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.
same in the other tests below...
tests/bench_ctx_switch/main.c
Outdated
n++; | ||
} | ||
flag = 0; | ||
printf("Test complete. n=%u\n", n); |
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.
Could we make the output a little more verbose, as in "Test complete: X context switches per second" or similar?
Also: if I am not mistaken, we do 2 * n
context switches per second, correct?
tests/bench_msg/main.c
Outdated
n++; | ||
} | ||
flag = 0; | ||
printf("Test complete. n=%u\n", n); |
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.
same here (and below)
I know you gonna hate this: but I think for completeness there should be a README.md for each test, right? |
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.
Since #7871 is done (all mentioned tests there now have an associated testrunner script), it would be great to add test scripts here as well.
@kaspar030 in the process of advancing with #7445 I noticed that it would be very useful to have these benchmark applications to get a better feeling about any potential run-time side effects. I would like to help, too :-) What I would also like to add, is some run-time measurements for certain API function calls, e.g. measure the time it takes to call a million times
What do you think is the most feasible? As said: I will gladly do or help with any possibly needed refactoring/cleanup. |
1f56f0f
to
d2af1a2
Compare
|
(as discussed offline) I'd like to keep the context switch tests of this PR as is in order to be able to compare code size of these simple use cases over time. |
@aabadie seems to me like all issues are addressed, do you give green light for merging this PR now? |
Pushed a note explaining code duplication. This is ready for review, @danpetry @haukepetersen wanna take a look? |
@aabadie are the tests to your liking? |
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.
All good from my side.
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.
Found minor stuff here.
tests/bench_msg_pingpong/Makefile
Outdated
@@ -0,0 +1,12 @@ | |||
include ../Makefile.tests_common | |||
|
|||
BOARD_INSUFFICIENT_MEMORY := nucleo32-f031 |
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.
should be nucleo-f031k6 now
|
||
|
||
def testfunc(child): | ||
child.expect_exact(u"{ \"result\" :") |
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.
Since the script is python 3 only, there's no need for the u
tests/bench_mutex_pingpong/Makefile
Outdated
@@ -0,0 +1,12 @@ | |||
include ../Makefile.tests_common | |||
|
|||
BOARD_INSUFFICIENT_MEMORY := nucleo32-f031 |
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.
same problem with nucleo board name
|
||
|
||
def testfunc(child): | ||
child.expect_exact(u"{ \"result\" :") |
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.
u
tests/bench_sched_nop/Makefile
Outdated
@@ -0,0 +1,12 @@ | |||
include ../Makefile.tests_common | |||
|
|||
BOARD_INSUFFICIENT_MEMORY := nucleo32-f031 |
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.
nucleo
|
||
|
||
def testfunc(child): | ||
child.expect_exact(u"{ \"result\" :") |
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.
u
@@ -0,0 +1,13 @@ | |||
include ../Makefile.tests_common | |||
|
|||
BOARD_INSUFFICIENT_MEMORY := nucleo32-f031 |
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.
nucleo, I stop here
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.
ACK, please squash!
1c7776b
to
43bb05d
Compare
2332b06
to
3c9eb94
Compare
(they worked previously, but the match ended like this: ```{ "result" : ````(cutting the rest of the line). Now the expect line includes the whole line, so the actual result shows up in the test run's output. @aabadie maybe re-ack? |
ACK, and go |
This PR adds some benchmark applications that I've been using for benchmarking RIOT's IPC performance.