[riot-notifications] [RIOT-OS/RIOT] core/schedstatistics: fix call to uninitialized xtimer (#11781)

Francisco notifications at github.com
Thu Jul 25 18:19:54 CEST 2019

fjmolinas commented on this pull request.

+void sched_register_cb(void (*callback)(uint32_t, uint32_t))
+    sched_cb = callback;
+void sched_statistics_cb(uint32_t active_thread, uint32_t next_thread) {
+    uint32_t now = xtimer_now().ticks32;
+    if((thread_getstatus(active_thread) != STATUS_STOPPED) && \
+       (thread_getstatus(active_thread) != STATUS_NOT_FOUND)) {
+        schedstat_t *active_stat = &sched_pidlist[active_thread];
+        if (active_stat->laststart) {

Well actually it was only done for one thread since it was only called from `kernel_init`. I removed the code that set `active_stat->laststart = 0` since it wasn't really being used, and even is set to 0 this check needs to be done since the run-time shouldn't be updated on the first schedule.

I added an else statement so `runtime_ticks` gets initialized to 0.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190725/d818332e/attachment.htm>

More information about the notifications mailing list