From 89c0313938aea0618a624b7230ed29cebe723d75 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 21 Dec 2017 14:31:55 +0100 Subject: score: Optimize watchdog tickle Avoid unnecessary lock acquire/release operations. Get realtime via timecounter only if necessary. Update #3264. --- testsuites/sptests/spwatchdog/init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/spwatchdog/init.c b/testsuites/sptests/spwatchdog/init.c index 0c7d41fd33..5b6266d033 100644 --- a/testsuites/sptests/spwatchdog/init.c +++ b/testsuites/sptests/spwatchdog/init.c @@ -82,10 +82,18 @@ static uint64_t test_watchdog_tick( Watchdog_Header *header, uint64_t now ) { ISR_LOCK_DEFINE( , lock, "Test" ) ISR_lock_Context lock_context; + Watchdog_Control *first; _ISR_lock_ISR_disable_and_acquire( &lock, &lock_context ); + ++now; - _Watchdog_Tickle( header, now, &lock, &lock_context ); + first = _Watchdog_Header_first( header ); + + if ( first != NULL ) { + _Watchdog_Tickle( header, first, now, &lock, &lock_context ); + } + + _ISR_lock_Release_and_ISR_enable( &lock, &lock_context ); _ISR_lock_Destroy( &lock ); return now; -- cgit v1.2.3