summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r--cpukit/rtems/src/clockgetsecondssinceepoch.c2
-rw-r--r--cpukit/rtems/src/clockgetuptime.c3
-rw-r--r--cpukit/rtems/src/ratemongetstatus.c12
-rw-r--r--cpukit/rtems/src/ratemonperiod.c35
-rw-r--r--cpukit/rtems/src/ratemonreportstatistics.c49
-rw-r--r--cpukit/rtems/src/taskwakewhen.c4
-rw-r--r--cpukit/rtems/src/timerfirewhen.c4
-rw-r--r--cpukit/rtems/src/timerserver.c4
-rw-r--r--cpukit/rtems/src/timerserverfirewhen.c4
9 files changed, 55 insertions, 62 deletions
diff --git a/cpukit/rtems/src/clockgetsecondssinceepoch.c b/cpukit/rtems/src/clockgetsecondssinceepoch.c
index 9c1badfe99..c8fcdc3183 100644
--- a/cpukit/rtems/src/clockgetsecondssinceepoch.c
+++ b/cpukit/rtems/src/clockgetsecondssinceepoch.c
@@ -33,6 +33,6 @@ rtems_status_code rtems_clock_get_seconds_since_epoch(
if ( !_TOD_Is_set )
return RTEMS_NOT_DEFINED;
- *the_interval = _TOD_Seconds_since_epoch;
+ *the_interval = _TOD_Seconds_since_epoch();
return RTEMS_SUCCESSFUL;
}
diff --git a/cpukit/rtems/src/clockgetuptime.c b/cpukit/rtems/src/clockgetuptime.c
index 9fa88ef74b..9ac834c5f5 100644
--- a/cpukit/rtems/src/clockgetuptime.c
+++ b/cpukit/rtems/src/clockgetuptime.c
@@ -20,6 +20,7 @@
#include <rtems/rtems/clock.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
+#include <rtems/score/timestamp.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdog.h>
@@ -45,6 +46,6 @@ rtems_status_code rtems_clock_get_uptime(
if ( !uptime )
return RTEMS_INVALID_ADDRESS;
- _TOD_Get_uptime( uptime );
+ _TOD_Get_uptime_as_timespec( uptime );
return RTEMS_SUCCESSFUL;
}
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c
index ef47a032e5..59b39e2917 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -65,14 +65,12 @@ rtems_status_code rtems_rate_monotonic_get_status(
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
- status->since_last_period.tv_sec = 0;
- status->since_last_period.tv_nsec = 0;
+ _Timestamp_Set_to_zero( &status->since_last_period );
#else
status->since_last_period = 0;
#endif
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
- status->executed_since_last_period.tv_sec = 0;
- status->executed_since_last_period.tv_nsec = 0;
+ _Timestamp_Set_to_zero( &status->executed_since_last_period );
#else
status->executed_since_last_period = 0;
#endif
@@ -83,12 +81,12 @@ rtems_status_code rtems_rate_monotonic_get_status(
*/
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
- struct timespec uptime;
+ Timestamp_Control uptime;
_TOD_Get_uptime( &uptime );
#endif
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
- _Timespec_Subtract(
+ _Timestamp_Subtract(
&the_period->time_at_period,
&uptime,
&status->since_last_period
@@ -99,7 +97,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
#endif
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
- _Timespec_Subtract(
+ _Timestamp_Subtract(
&_Thread_Time_of_last_context_switch,
&uptime,
&status->executed_since_last_period
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 26db51f43b..db3b179e98 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -22,11 +22,6 @@
#include <rtems/score/object.h>
#include <rtems/rtems/ratemon.h>
#include <rtems/score/thread.h>
-#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
- defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
- #include <rtems/score/timespec.h>
- extern struct timespec _Thread_Time_of_last_context_switch;
-#endif
void _Rate_monotonic_Update_statistics(
Rate_monotonic_Control *the_period
@@ -40,7 +35,7 @@ void _Rate_monotonic_Update_statistics(
#endif
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
- struct timespec uptime;
+ Timestamp_Control uptime;
/*
* Obtain the current time since boot
@@ -60,7 +55,7 @@ void _Rate_monotonic_Update_statistics(
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
period_start = the_period->time_at_period;
- _Timespec_Subtract( &period_start, &uptime, &since_last_period );
+ _Timestamp_Subtract( &period_start, &uptime, &since_last_period );
the_period->time_at_period = uptime;
#else
since_last_period = _Watchdog_Ticks_since_boot - the_period->time_at_period;
@@ -75,17 +70,17 @@ void _Rate_monotonic_Update_statistics(
used = _Thread_Executing->cpu_time_used;
/* partial period, cpu usage info reset while executing. Throw away */
- if (_Timespec_Less_than( &used, &the_period->owner_executed_at_period))
+ if (_Timestamp_Less_than( &used, &the_period->owner_executed_at_period))
return;
/* How much time time since last context switch */
- _Timespec_Subtract(&_Thread_Time_of_last_context_switch, &uptime, &ran);
+ _Timestamp_Subtract(&_Thread_Time_of_last_context_switch, &uptime, &ran);
/* executed += ran */
- _Timespec_Add_to( &used, &ran );
+ _Timestamp_Add_to( &used, &ran );
/* executed = current cpu usage - value at start of period */
- _Timespec_Subtract(
+ _Timestamp_Subtract(
&the_period->owner_executed_at_period,
&used,
&executed
@@ -112,12 +107,12 @@ void _Rate_monotonic_Update_statistics(
*/
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
- _Timespec_Add_to( &stats->total_cpu_time, &executed );
+ _Timestamp_Add_to( &stats->total_cpu_time, &executed );
- if ( _Timespec_Less_than( &executed, &stats->min_cpu_time ) )
+ if ( _Timestamp_Less_than( &executed, &stats->min_cpu_time ) )
stats->min_cpu_time = executed;
- if ( _Timespec_Greater_than( &executed, &stats->max_cpu_time ) )
+ if ( _Timestamp_Greater_than( &executed, &stats->max_cpu_time ) )
stats->max_cpu_time = executed;
#else
stats->total_cpu_time += executed;
@@ -142,12 +137,12 @@ void _Rate_monotonic_Update_statistics(
if ( since_last_period > stats->max_wall_time )
stats->max_wall_time = since_last_period;
#else
- _Timespec_Add_to( &stats->total_wall_time, &since_last_period );
+ _Timestamp_Add_to( &stats->total_wall_time, &since_last_period );
- if ( _Timespec_Less_than( &since_last_period, &stats->min_wall_time ) )
+ if ( _Timestamp_Less_than( &since_last_period, &stats->min_wall_time ) )
stats->min_wall_time = since_last_period;
- if ( _Timespec_Greater_than( &since_last_period, &stats->max_wall_time ) )
+ if ( _Timestamp_Greater_than( &since_last_period, &stats->max_wall_time ) )
stats->max_wall_time = since_last_period;
#endif
}
@@ -211,7 +206,7 @@ rtems_status_code rtems_rate_monotonic_period(
case RATE_MONOTONIC_INACTIVE: {
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
- struct timespec uptime;
+ Timestamp_Control uptime;
#endif
/*
@@ -244,7 +239,7 @@ rtems_status_code rtems_rate_monotonic_period(
_Thread_Executing->cpu_time_used;
/* How much time time since last context switch */
- _Timespec_Subtract(
+ _Timestamp_Subtract(
&_Thread_Time_of_last_context_switch,
&uptime,
&ran
@@ -254,7 +249,7 @@ rtems_status_code rtems_rate_monotonic_period(
*
* the_period->owner_executed_at_period += ran
*/
- _Timespec_Add_to( &the_period->owner_executed_at_period, &ran );
+ _Timestamp_Add_to( &the_period->owner_executed_at_period, &ran );
}
#else
the_period->owner_executed_at_period =
diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c
index e8949f4b5e..02a0237faa 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -24,7 +24,7 @@
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
- #include <rtems/score/timespec.h>
+ #include <rtems/score/timestamp.h>
/* We print to 1/10's of milliseconds */
#define NANOSECONDS_DIVIDER 1000
@@ -149,23 +149,22 @@ ididididid NNNN ccccc mmmmmm X
*/
{
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
- struct timespec cpu_average;
+ Timestamp_Control cpu_average;
+ Timestamp_Control *min_cpu = &the_stats.min_cpu_time;
+ Timestamp_Control *max_cpu = &the_stats.max_cpu_time;
+ Timestamp_Control *total_cpu = &the_stats.total_cpu_time;
- _Timespec_Divide_by_integer(
- &the_stats.total_cpu_time,
- the_stats.count,
- &cpu_average
- );
+ _Timestamp_Divide_by_integer( total_cpu, the_stats.count, &cpu_average );
(*print)( context,
"%" PRId32 "." NANOSECONDS_FMT "/" /* min cpu time */
"%" PRId32 "." NANOSECONDS_FMT "/" /* max cpu time */
"%" PRId32 "." NANOSECONDS_FMT " ", /* avg cpu time */
- the_stats.min_cpu_time.tv_sec,
- the_stats.min_cpu_time.tv_nsec / NANOSECONDS_DIVIDER,
- the_stats.max_cpu_time.tv_sec,
- the_stats.max_cpu_time.tv_nsec / NANOSECONDS_DIVIDER,
- cpu_average.tv_sec,
- cpu_average.tv_nsec / NANOSECONDS_DIVIDER
+ _Timestamp_Get_seconds( min_cpu ),
+ _Timestamp_Get_nanoseconds( min_cpu ) / NANOSECONDS_DIVIDER,
+ _Timestamp_Get_seconds( max_cpu ),
+ _Timestamp_Get_nanoseconds( max_cpu ) / NANOSECONDS_DIVIDER,
+ _Timestamp_Get_seconds( &cpu_average ),
+ _Timestamp_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
);
#else
uint32_t ival_cpu, fval_cpu;
@@ -186,22 +185,22 @@ ididididid NNNN ccccc mmmmmm X
*/
{
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
- struct timespec wall_average;
- _Timespec_Divide_by_integer(
- &the_stats.total_wall_time,
- the_stats.count,
- &wall_average
- );
+ Timestamp_Control wall_average;
+ Timestamp_Control *min_wall = &the_stats.min_wall_time;
+ Timestamp_Control *max_wall = &the_stats.max_wall_time;
+ Timestamp_Control *total_wall = &the_stats.total_wall_time;
+
+ _Timestamp_Divide_by_integer(total_wall, the_stats.count, &wall_average);
(*print)( context,
"%" PRId32 "." NANOSECONDS_FMT "/" /* min wall time */
"%" PRId32 "." NANOSECONDS_FMT "/" /* max wall time */
"%" PRId32 "." NANOSECONDS_FMT "\n", /* avg wall time */
- the_stats.min_wall_time.tv_sec,
- the_stats.min_wall_time.tv_nsec / NANOSECONDS_DIVIDER,
- the_stats.max_wall_time.tv_sec,
- the_stats.max_wall_time.tv_nsec / NANOSECONDS_DIVIDER,
- wall_average.tv_sec,
- wall_average.tv_nsec / NANOSECONDS_DIVIDER
+ _Timestamp_Get_seconds( min_wall ),
+ _Timestamp_Get_nanoseconds( min_wall ) / NANOSECONDS_DIVIDER,
+ _Timestamp_Get_seconds( max_wall ),
+ _Timestamp_Get_nanoseconds( max_wall ) / NANOSECONDS_DIVIDER,
+ _Timestamp_Get_seconds( &wall_average ),
+ _Timestamp_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER
);
#else
uint32_t ival_wall, fval_wall;
diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c
index 96f7db2618..5496f55a73 100644
--- a/cpukit/rtems/src/taskwakewhen.c
+++ b/cpukit/rtems/src/taskwakewhen.c
@@ -67,7 +67,7 @@ rtems_status_code rtems_task_wake_when(
seconds = _TOD_To_seconds( time_buffer );
- if ( seconds <= _TOD_Seconds_since_epoch )
+ if ( seconds <= _TOD_Seconds_since_epoch() )
return RTEMS_INVALID_CLOCK;
_Thread_Disable_dispatch();
@@ -80,7 +80,7 @@ rtems_status_code rtems_task_wake_when(
);
_Watchdog_Insert_seconds(
&_Thread_Executing->Timer,
- seconds - _TOD_Seconds_since_epoch
+ seconds - _TOD_Seconds_since_epoch()
);
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
diff --git a/cpukit/rtems/src/timerfirewhen.c b/cpukit/rtems/src/timerfirewhen.c
index bf1ffd568e..84ed3f6520 100644
--- a/cpukit/rtems/src/timerfirewhen.c
+++ b/cpukit/rtems/src/timerfirewhen.c
@@ -63,7 +63,7 @@ rtems_status_code rtems_timer_fire_when(
return RTEMS_INVALID_ADDRESS;
seconds = _TOD_To_seconds( wall_time );
- if ( seconds <= _TOD_Seconds_since_epoch )
+ if ( seconds <= _TOD_Seconds_since_epoch() )
return RTEMS_INVALID_CLOCK;
the_timer = _Timer_Get( id, &location );
@@ -75,7 +75,7 @@ rtems_status_code rtems_timer_fire_when(
_Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
_Watchdog_Insert_seconds(
&the_timer->Ticker,
- seconds - _TOD_Seconds_since_epoch
+ seconds - _TOD_Seconds_since_epoch()
);
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
diff --git a/cpukit/rtems/src/timerserver.c b/cpukit/rtems/src/timerserver.c
index 9c4ea90b50..5f4b318e35 100644
--- a/cpukit/rtems/src/timerserver.c
+++ b/cpukit/rtems/src/timerserver.c
@@ -189,7 +189,7 @@ static void _Timer_Server_process_seconds_chain(
* of Day (TOD) has not been set backwards. If it has then
* we want to adjust the _Timer_Seconds_chain to indicate this.
*/
- snapshot = _TOD_Seconds_since_epoch;
+ snapshot = _TOD_Seconds_since_epoch();
if ( snapshot > _Timer_Server_seconds_last_time ) {
/*
* This path is for normal forward movement and cases where the
@@ -232,7 +232,7 @@ Thread _Timer_Server_body(
* the server was initiated.
*/
_Timer_Server_ticks_last_time = _Watchdog_Ticks_since_boot;
- _Timer_Server_seconds_last_time = _TOD_Seconds_since_epoch;
+ _Timer_Server_seconds_last_time = _TOD_Seconds_since_epoch();
/*
* Insert the timers that were inserted before we got to run.
diff --git a/cpukit/rtems/src/timerserverfirewhen.c b/cpukit/rtems/src/timerserverfirewhen.c
index a1f2caee6f..d8b503e274 100644
--- a/cpukit/rtems/src/timerserverfirewhen.c
+++ b/cpukit/rtems/src/timerserverfirewhen.c
@@ -67,7 +67,7 @@ rtems_status_code rtems_timer_server_fire_when(
return RTEMS_INVALID_CLOCK;
seconds = _TOD_To_seconds( wall_time );
- if ( seconds <= _TOD_Seconds_since_epoch )
+ if ( seconds <= _TOD_Seconds_since_epoch() )
return RTEMS_INVALID_CLOCK;
the_timer = _Timer_Get( id, &location );
@@ -77,7 +77,7 @@ rtems_status_code rtems_timer_server_fire_when(
(void) _Watchdog_Remove( &the_timer->Ticker );
the_timer->the_class = TIMER_TIME_OF_DAY_ON_TASK;
_Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
- the_timer->Ticker.initial = seconds - _TOD_Seconds_since_epoch;
+ the_timer->Ticker.initial = seconds - _TOD_Seconds_since_epoch();
/*
* _Timer_Server_schedule_operation != NULL because we checked that