-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Description
We are not properly performing the driver lookup when we perform an unlock of the deep sleep counter. This only affects the stats counter and not the sleep counter itself, but it leads to confusing results when using the sleep tracer to monitor sleep.
Test Program:
#include "mbed.h"
Timer timmy;
int main() {
// starting a timer increments sleep lock count
timmy.start();
// wait will bump the sleep count and decrement it
wait (3);
// stop the timer... this should reduce the sleep lock count
timmy.stop();
} // end main()
This results in:
LOCK: Timer.cpp, ln: 54, lock count: 1
LOCK: mbed_wait_api_rtos.cpp, ln: 45, lock count: 2
Sleep locks held:
[id: Timer.cpp, count: 1]
[id: mbed_wait_api_rtos.cpp, count: 1]
UNLOCK: mbed_wait_api_rtos.cpp, ln: 47, lock count: 1
Unlocking sleep for driver that was not previously locked: Timer.cpp, ln: 68
Sleep locks held:
[id: Timer.cpp, count: 1]
It still shows the timer holding a sleep lock when it has actually been released.
If we revert commit 9a0e879 then the problem goes away. We were doing a strcmp instead of a pointer compare in sleep_tracker_find():
9a0e879#diff-4ef16dda46f5130a57b304fed2459ee3L53
Issue request type
[ ] Question
[ ] Enhancement
[X] Bug
deepikabhavnani