schedstats: revert to 32Bit, and enhance output of schedstats#7048
schedstats: revert to 32Bit, and enhance output of schedstats#7048kaspar030 merged 3 commits intoRIOT-OS:masterfrom
Conversation
e6e3ce0 to
1346d3b
Compare
|
As this touches the scheduler, we need to check for impact on context switch times. ping if you need test applications... |
|
@kaspar030 ping 😉 I think this should also be tested for #6975? Because that introduces most of the changes, here I merely get rid of double and replace it by 2 unsigned ints. |
|
needs a rebase |
|
partly reverts #6975 back to 32Bit timer, gets rid of float in ps output, and enhances the ps_schedstats tests |
core/include/sched.h
Outdated
| * @param[in] callback The callback functions the will be called | ||
| */ | ||
| void sched_register_cb(void (*callback)(uint32_t, uint32_t)); | ||
| void sched_register_cb(void (*callback)(uint64_t, uint32_t)); |
There was a problem hiding this comment.
First parameter could remain uint32_t as laststart is.
tests/ps_schedstatistics/main.c
Outdated
| { | ||
| int next = (int)arg < NB_THREADS - 1 ? (int)arg + 1 : 0; | ||
| msg_t msg; | ||
| int next = ((int)arg +1) % NB_THREADS; |
tests/ps_schedstatistics/main.c
Outdated
| msg_t m1, m2; | ||
| msg_receive(&m1); | ||
| /* generate differents loads per thead */ | ||
| for (int i = 0; i < 10*(next+1); ++i) { |
tests/ps_schedstatistics/main.c
Outdated
| for (int i = 0; i < 10*(next+1); ++i) { | ||
| _xtimer_now64(); | ||
| } | ||
| xtimer_usleep(XTIMER_BACKOFF*3); |
|
comments addressed |
31096b7 to
d6b670c
Compare
|
Something is wrong with ratio calculation: (This was on nucleo144-f413) |
|
yeah, |
|
I tested with native, where the values seem to be okay and the sum < 100%. However, I also tested on |
sys/ps/ps.c
Outdated
| unsigned runtime_major = (runtime_ticks * 100) / rt_sum; | ||
| unsigned runtime_minor = ((runtime_ticks % rt_sum) * 1000) / rt_sum; | ||
| /* add trailing zeros */ | ||
| while(runtime_minor < 100) { |
There was a problem hiding this comment.
note to self: this shouldn't be necessary
|
some performance results using @kaspar030 bench_msg tool:
|
|
@kaspar030 your review in this one? |
core/sched.c
Outdated
| schedstat *active_stat = &sched_pidlist[active_thread->pid]; | ||
| if (active_stat->laststart) { | ||
| active_stat->runtime_ticks += now - active_stat->laststart; | ||
| /* ensure now > laststart, to avoid flawed sum of runtime ticks |
There was a problem hiding this comment.
IMO we can remove this check. It doesn't catch all overflows anyways. Worse, it drops indeterministic periods depending on when the thread got scheduled.
I think that losing 71minute overflows, and documenting that properly, is preferable than this.
There was a problem hiding this comment.
... losing 71minute overflows ...
It would mean that all running/sleeping periods would be counted module 2**32 xtimer ticks, which is ~71minutes. I doubt that it would have significant impact in ps output, compared to dropping all periods that happen to have an overflow.
There was a problem hiding this comment.
mhm, how do you get 71 minutes? Doesn't that depend on the timer frequency - which is 1MHz for many boards but 250kHz for Ardunio Uno, for instance ...
There was a problem hiding this comment.
I changed the calculation to be more generic, should be cool now 🤓
core/sched.c
Outdated
| active_stat->runtime_ticks += now - active_stat->laststart; | ||
| } | ||
| /* add up runtime, overflow compatible */ | ||
| active_stat->runtime_ticks += (((uint64_t)now + UINT32_MAX) - |
There was a problem hiding this comment.
what does this to compared to the simple difference?
There was a problem hiding this comment.
öhm, actually nothing - I was thinking to complicated, need coffee ...
There was a problem hiding this comment.
btw. reverted to simple difference
|
@kaspar030 addressed your comments, happy? |
- use unsigned int instead of double
|
@kaspar030 do you mind having a look again? |
|
ping @kaspar030. This one is ready, only your ACK is missing. |
|
long time no see, @kaspar030 anything to add here? |
|
@kaspar030 still waiting for you to come back here and have a look |
|
@kaspar030 this one hangs around for some time now, IIRC you weren't happy with the 64bit changes so why not revert and improve with this one? |
|
and another ping @kaspar030, this (re)improves test performance as you wished 😉 |
based on #6975