score: Rename watchdog variants

Rename PER_CPU_WATCHDOG_RELATIVE in PER_CPU_WATCHDOG_MONOTONIC to
highlight the corresponding POSIX CLOCK_MONOTONIC.

Rename PER_CPU_WATCHDOG_ABSOLUTE in PER_CPU_WATCHDOG_REALTIME to
highlight the corresponding POSIX CLOCK_REALTIME.

Update #3117.
Update #3182.
This commit is contained in:
Sebastian Huber
2017-10-17 08:15:40 +02:00
parent f4009d8b8e
commit bf2a53d272
23 changed files with 60 additions and 56 deletions
@@ -56,7 +56,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
the_thread->cpu_time_budget =
_Timespec_To_ticks( &api->schedparam.sched_ss_init_budget );
_Watchdog_Per_CPU_insert_relative(
_Watchdog_Per_CPU_insert_monotonic(
&api->Sporadic.Timer,
_Per_CPU_Get(),
_Timespec_To_ticks( &api->schedparam.sched_ss_repl_period )
+2 -2
View File
@@ -77,14 +77,14 @@ unsigned int alarm(
now = cpu->Watchdog.ticks;
remaining = (unsigned long) _Watchdog_Cancel(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
the_watchdog,
now
);
if ( ticks != 0 ) {
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
the_watchdog,
now + ticks
);
+2 -2
View File
@@ -69,7 +69,7 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
_Priority_Node_set_inactive( &api->Sporadic.Low_priority );
}
_Watchdog_Per_CPU_remove_relative( &api->Sporadic.Timer );
_Watchdog_Per_CPU_remove_monotonic( &api->Sporadic.Timer );
_POSIX_Threads_Sporadic_timer_insert( the_thread, api );
_Thread_Wait_release( the_thread, &queue_context );
@@ -165,7 +165,7 @@ static void _POSIX_Threads_Terminate_extension( Thread_Control *executing )
_Thread_State_acquire( executing, &lock_context );
if ( api->schedpolicy == SCHED_SPORADIC ) {
_Watchdog_Per_CPU_remove_relative( &api->Sporadic.Timer );
_Watchdog_Per_CPU_remove_monotonic( &api->Sporadic.Timer );
}
_Thread_State_release( executing, &lock_context );
+1 -1
View File
@@ -69,7 +69,7 @@ static int _POSIX_Set_sched_param(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
_Watchdog_Per_CPU_remove_relative( &api->Sporadic.Timer );
_Watchdog_Per_CPU_remove_monotonic( &api->Sporadic.Timer );
_Priority_Node_set_priority( &the_thread->Real_priority, core_normal_prio );
+1 -1
View File
@@ -56,7 +56,7 @@ int timer_delete(
cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
ptimer->state = POSIX_TIMER_STATE_FREE;
_Watchdog_Remove(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
&ptimer->Timer
);
_POSIX_Timer_Release( cpu, &lock_context );
+2 -2
View File
@@ -42,7 +42,7 @@ static void _POSIX_Timer_Insert(
_TOD_Get( &ptimer->time );
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
&ptimer->Timer,
cpu->Watchdog.ticks + ticks
);
@@ -152,7 +152,7 @@ int timer_settime(
/* Stop the timer */
_Watchdog_Remove(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
&ptimer->Timer
);
+3 -3
View File
@@ -55,7 +55,7 @@ static void _POSIX_signals_Ualarm_TSR( Watchdog_Control *the_watchdog )
* If the reset interval is non-zero, reschedule ourselves.
*/
if ( _POSIX_signals_Ualarm_interval != 0 ) {
_Watchdog_Per_CPU_insert_relative(
_Watchdog_Per_CPU_insert_monotonic(
the_watchdog,
_Per_CPU_Get(),
_POSIX_signals_Ualarm_interval
@@ -107,7 +107,7 @@ useconds_t ualarm(
now = cpu->Watchdog.ticks;
remaining = (useconds_t) _Watchdog_Cancel(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
the_watchdog,
now
);
@@ -118,7 +118,7 @@ useconds_t ualarm(
cpu = _Per_CPU_Get();
_Watchdog_Set_CPU( the_watchdog, cpu );
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
the_watchdog,
now + ticks_initial
);
+1 -1
View File
@@ -81,7 +81,7 @@ rtems_status_code _Event_Seize(
_Thread_Wait_release_default( executing, lock_context );
if ( ticks ) {
_Thread_Timer_insert_relative(
_Thread_Timer_insert_monotonic(
executing,
cpu_self,
_Thread_Timeout,
+1 -1
View File
@@ -32,7 +32,7 @@ void _Rate_monotonic_Cancel(
_Rate_monotonic_Acquire_critical( the_period, lock_context );
_Watchdog_Per_CPU_remove_relative( &the_period->Timer );
_Watchdog_Per_CPU_remove_monotonic( &the_period->Timer );
the_period->state = RATE_MONOTONIC_INACTIVE;
_Scheduler_Cancel_job(
the_period->owner,
+1 -1
View File
@@ -101,7 +101,7 @@ static void _Rate_monotonic_Release_job(
cpu_self = _Thread_Dispatch_disable_critical( lock_context );
deadline = _Watchdog_Per_CPU_insert_relative(
deadline = _Watchdog_Per_CPU_insert_monotonic(
&the_period->Timer,
cpu_self,
next_length
+1 -1
View File
@@ -36,7 +36,7 @@ static void _Rate_monotonic_Renew_deadline(
the_period->state = RATE_MONOTONIC_EXPIRED;
deadline = _Watchdog_Per_CPU_insert_relative(
deadline = _Watchdog_Per_CPU_insert_monotonic(
&the_period->Timer,
_Per_CPU_Get(),
the_period->next_length
+1 -1
View File
@@ -41,7 +41,7 @@ rtems_status_code rtems_task_wake_after(
} else {
_Thread_Set_state( executing, STATES_WAITING_FOR_TIME );
_Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED );
_Thread_Timer_insert_relative(
_Thread_Timer_insert_monotonic(
executing,
cpu_self,
_Thread_Timeout,
+1 -1
View File
@@ -52,7 +52,7 @@ rtems_status_code rtems_task_wake_when(
executing = _Thread_Executing;
_Thread_Set_state( executing, STATES_WAITING_FOR_TIME );
_Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED );
_Thread_Timer_insert_absolute(
_Thread_Timer_insert_realtime(
executing,
cpu_self,
_Thread_Timeout,
+3 -3
View File
@@ -29,7 +29,7 @@
#include <rtems/score/watchdogimpl.h>
RTEMS_STATIC_ASSERT(
PER_CPU_WATCHDOG_ABSOLUTE == TIMER_CLASS_BIT_TIME_OF_DAY,
PER_CPU_WATCHDOG_REALTIME == TIMER_CLASS_BIT_TIME_OF_DAY,
TIMER_CLASS_BIT_TIME_OF_DAY
);
@@ -72,13 +72,13 @@ rtems_status_code _Timer_Fire(
if ( _Timer_Is_interval_class( the_class ) ) {
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
&the_timer->Ticker,
cpu->Watchdog.ticks + interval
);
} else {
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_ABSOLUTE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ],
&the_timer->Ticker,
_Watchdog_Ticks_from_seconds( interval )
);
+1 -1
View File
@@ -37,7 +37,7 @@ rtems_status_code rtems_timer_reset(
if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
_Timer_Cancel( cpu, the_timer );
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
&the_timer->Ticker,
cpu->Watchdog.ticks + the_timer->initial
);
+13 -9
View File
@@ -248,20 +248,23 @@ typedef struct {
*/
typedef enum {
/**
* @brief Index for relative per-CPU watchdog header.
* @brief Index for monotonic clock per-CPU watchdog header.
*
* The reference time point for this header is current ticks value
* during insert. Time is measured in clock ticks.
* The reference time point for the monotonic clock is the system start. The
* clock resolution is one system clock tick. It is used for the system
* clock tick based time services and the POSIX services using
* CLOCK_MONOTONIC.
*/
PER_CPU_WATCHDOG_RELATIVE,
PER_CPU_WATCHDOG_MONOTONIC,
/**
* @brief Index for absolute per-CPU watchdog header.
* @brief Index for realtime clock per-CPU watchdog header.
*
* The reference time point for this header is the POSIX Epoch. Time is
* measured in nanoseconds since POSIX Epoch.
* The reference time point for the realtime clock is the POSIX Epoch. The
* clock resolution is one nanosecond. It is used for the time of day
* services and the POSIX services using CLOCK_REALTIME.
*/
PER_CPU_WATCHDOG_ABSOLUTE,
PER_CPU_WATCHDOG_REALTIME,
/**
* @brief Count of per-CPU watchdog headers.
@@ -395,7 +398,8 @@ typedef struct Per_CPU_Control {
ISR_LOCK_MEMBER( Lock )
/**
* @brief Watchdog ticks on this processor used for relative watchdogs.
* @brief Watchdog ticks on this processor used for monotonic clock
* watchdogs.
*/
uint64_t ticks;
@@ -1853,11 +1853,11 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize(
)
{
_ISR_lock_Initialize( &timer->Lock, "Thread Timer" );
timer->header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ];
timer->header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ];
_Watchdog_Preinitialize( &timer->Watchdog, cpu );
}
RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_relative(
RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_monotonic(
Thread_Control *the_thread,
Per_CPU_Control *cpu,
Watchdog_Service_routine_entry routine,
@@ -1869,14 +1869,14 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_relative(
_ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
the_thread->Timer.header =
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ];
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ];
the_thread->Timer.Watchdog.routine = routine;
_Watchdog_Per_CPU_insert_relative( &the_thread->Timer.Watchdog, cpu, ticks );
_Watchdog_Per_CPU_insert_monotonic( &the_thread->Timer.Watchdog, cpu, ticks );
_ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
}
RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_absolute(
RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_realtime(
Thread_Control *the_thread,
Per_CPU_Control *cpu,
Watchdog_Service_routine_entry routine,
@@ -1888,9 +1888,9 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_absolute(
_ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
the_thread->Timer.header =
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_ABSOLUTE ];
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ];
the_thread->Timer.Watchdog.routine = routine;
_Watchdog_Per_CPU_insert_absolute( &the_thread->Timer.Watchdog, cpu, expire );
_Watchdog_Per_CPU_insert_realtime( &the_thread->Timer.Watchdog, cpu, expire );
_ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
}
+10 -10
View File
@@ -351,7 +351,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_release_critical(
_ISR_lock_Release( &cpu->Watchdog.Lock, lock_context );
}
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_relative(
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_monotonic(
Watchdog_Control *the_watchdog,
Per_CPU_Control *cpu,
Watchdog_Interval ticks
@@ -361,7 +361,7 @@ RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_relative(
Watchdog_Header *header;
uint64_t expire;
header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ];
header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ];
_Watchdog_Set_CPU( the_watchdog, cpu );
@@ -372,7 +372,7 @@ RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_relative(
return expire;
}
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_absolute(
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_realtime(
Watchdog_Control *the_watchdog,
Per_CPU_Control *cpu,
uint64_t expire
@@ -381,7 +381,7 @@ RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_absolute(
ISR_lock_Context lock_context;
Watchdog_Header *header;
header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_ABSOLUTE ];
header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ];
_Watchdog_Set_CPU( the_watchdog, cpu );
@@ -407,7 +407,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove(
_Watchdog_Per_CPU_release_critical( cpu, &lock_context );
}
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove_relative(
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove_monotonic(
Watchdog_Control *the_watchdog
)
{
@@ -417,11 +417,11 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove_relative(
_Watchdog_Per_CPU_remove(
the_watchdog,
cpu,
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ]
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ]
);
}
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove_absolute(
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove_realtime(
Watchdog_Control *the_watchdog
)
{
@@ -431,11 +431,11 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove_absolute(
_Watchdog_Per_CPU_remove(
the_watchdog,
cpu,
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_ABSOLUTE ]
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ]
);
}
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_tickle_absolute(
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_tickle_realtime(
Per_CPU_Control *cpu,
uint64_t now
)
@@ -444,7 +444,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_tickle_absolute(
_ISR_lock_ISR_disable_and_acquire( &cpu->Watchdog.Lock, &lock_context );
_Watchdog_Tickle(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_ABSOLUTE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ],
now,
&cpu->Watchdog.Lock,
&lock_context
+1 -1
View File
@@ -43,7 +43,7 @@ void _TOD_Set(
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
_Watchdog_Per_CPU_tickle_absolute( cpu, tod_as_ticks );
_Watchdog_Per_CPU_tickle_realtime( cpu, tod_as_ticks );
}
_TOD.is_set = true;
+2 -2
View File
@@ -385,7 +385,7 @@ static void _Thread_queue_Timeout(
case WATCHDOG_RELATIVE:
/* A relative timeout of 0 is a special case indefinite (no) timeout */
if ( queue_context->timeout != 0 ) {
_Thread_Timer_insert_relative(
_Thread_Timer_insert_monotonic(
the_thread,
cpu_self,
_Thread_Timeout,
@@ -394,7 +394,7 @@ static void _Thread_queue_Timeout(
}
break;
case WATCHDOG_ABSOLUTE:
_Thread_Timer_insert_absolute(
_Thread_Timer_insert_realtime(
the_thread,
cpu_self,
_Thread_Timeout,
+2 -2
View File
@@ -76,14 +76,14 @@ void _Watchdog_Tick( Per_CPU_Control *cpu )
cpu->Watchdog.ticks = ticks;
_Watchdog_Tickle(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ],
ticks,
&cpu->Watchdog.Lock,
&lock_context
);
_Timecounter_Getnanotime( &now );
_Watchdog_Per_CPU_tickle_absolute(
_Watchdog_Per_CPU_tickle_realtime(
cpu,
_Watchdog_Ticks_from_timespec( &now )
);
+2 -2
View File
@@ -45,7 +45,7 @@ static rtems_timer_service_routine test_release_from_isr(
)
{
Per_CPU_Control *cpu = _Per_CPU_Get();
Watchdog_Header *header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ];
Watchdog_Header *header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ];
Watchdog_Control *watchdog = (Watchdog_Control *) header->first;
if (
@@ -55,7 +55,7 @@ static rtems_timer_service_routine test_release_from_isr(
) {
Thread_Wait_flags flags = _Thread_Wait_flags_get( thread );
_Watchdog_Per_CPU_remove_relative( watchdog );
_Watchdog_Per_CPU_remove_monotonic( watchdog );
rtems_test_assert( getState() == RATE_MONOTONIC_ACTIVE );
+1 -1
View File
@@ -39,7 +39,7 @@ static rtems_timer_service_routine test_release_from_isr(
)
{
Per_CPU_Control *cpu_self = _Per_CPU_Get();
Watchdog_Header *header = &cpu_self->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ];
Watchdog_Header *header = &cpu_self->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ];
Watchdog_Control *watchdog = (Watchdog_Control *) header->first;
if (