forked from Imagelibrary/rtems
Remove use ticks for statistics configure option.
This was obsolete and broken based upon recent time keeping changes. Thie build option was previously enabled by adding USE_TICKS_FOR_STATISTICS=1 to the configure command line. This propagated into the code as preprocessor conditionals using the __RTEMS_USE_TICKS_FOR_STATISTICS__ conditional.
This commit is contained in:
@@ -240,11 +240,6 @@ RTEMS_CPUOPT([RTEMS_VERSION],
|
|||||||
["]_RTEMS_VERSION["],
|
["]_RTEMS_VERSION["],
|
||||||
[RTEMS version string])
|
[RTEMS version string])
|
||||||
|
|
||||||
RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
|
|
||||||
[test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
|
|
||||||
[1],
|
|
||||||
[disable nanosecond granularity for statistics])
|
|
||||||
|
|
||||||
## Header file differences that need to be known in .h after install
|
## Header file differences that need to be known in .h after install
|
||||||
RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
|
RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
|
||||||
[test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
|
[test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
|
||||||
|
|||||||
@@ -31,9 +31,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <rtems/seterr.h>
|
#include <rtems/seterr.h>
|
||||||
#include <rtems/score/todimpl.h>
|
#include <rtems/score/todimpl.h>
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#include <rtems/score/timestamp.h>
|
||||||
#include <rtems/score/timestamp.h>
|
|
||||||
#endif
|
|
||||||
#include <rtems/score/threadimpl.h>
|
#include <rtems/score/threadimpl.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,41 +61,35 @@ clock_t _times(
|
|||||||
* of ticks since boot and the number of ticks executed by this
|
* of ticks since boot and the number of ticks executed by this
|
||||||
* this thread.
|
* this thread.
|
||||||
*/
|
*/
|
||||||
|
{
|
||||||
|
Timestamp_Control per_tick;
|
||||||
|
uint32_t ticks_of_executing;
|
||||||
|
uint32_t fractional_ticks;
|
||||||
|
Per_CPU_Control *cpu_self;
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timestamp_Set(
|
||||||
{
|
&per_tick,
|
||||||
Timestamp_Control per_tick;
|
rtems_configuration_get_microseconds_per_tick() /
|
||||||
uint32_t ticks_of_executing;
|
TOD_MICROSECONDS_PER_SECOND,
|
||||||
uint32_t fractional_ticks;
|
(rtems_configuration_get_nanoseconds_per_tick() %
|
||||||
Per_CPU_Control *cpu_self;
|
TOD_NANOSECONDS_PER_SECOND)
|
||||||
|
);
|
||||||
|
|
||||||
_Timestamp_Set(
|
cpu_self = _Thread_Dispatch_disable();
|
||||||
&per_tick,
|
executing = _Thread_Executing;
|
||||||
rtems_configuration_get_microseconds_per_tick() /
|
_Thread_Update_cpu_time_used(
|
||||||
TOD_MICROSECONDS_PER_SECOND,
|
executing,
|
||||||
(rtems_configuration_get_nanoseconds_per_tick() %
|
&_Thread_Time_of_last_context_switch
|
||||||
TOD_NANOSECONDS_PER_SECOND)
|
);
|
||||||
);
|
_Timestamp_Divide(
|
||||||
|
&executing->cpu_time_used,
|
||||||
cpu_self = _Thread_Dispatch_disable();
|
&per_tick,
|
||||||
executing = _Thread_Executing;
|
&ticks_of_executing,
|
||||||
_Thread_Update_cpu_time_used(
|
&fractional_ticks
|
||||||
executing,
|
);
|
||||||
&_Thread_Time_of_last_context_switch
|
_Thread_Dispatch_enable( cpu_self );
|
||||||
);
|
ptms->tms_utime = ticks_of_executing * us_per_tick;
|
||||||
_Timestamp_Divide(
|
}
|
||||||
&executing->cpu_time_used,
|
|
||||||
&per_tick,
|
|
||||||
&ticks_of_executing,
|
|
||||||
&fractional_ticks
|
|
||||||
);
|
|
||||||
_Thread_Dispatch_enable( cpu_self );
|
|
||||||
ptms->tms_utime = ticks_of_executing * us_per_tick;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
executing = _Thread_Get_executing();
|
|
||||||
ptms->tms_utime = executing->cpu_time_used * us_per_tick;
|
|
||||||
#endif
|
|
||||||
ptms->tms_stime = ticks * us_per_tick;
|
ptms->tms_stime = ticks * us_per_tick;
|
||||||
ptms->tms_cutime = 0;
|
ptms->tms_cutime = 0;
|
||||||
ptms->tms_cstime = 0;
|
ptms->tms_cstime = 0;
|
||||||
|
|||||||
@@ -22,8 +22,4 @@
|
|||||||
|
|
||||||
#include <rtems/cpuuse.h>
|
#include <rtems/cpuuse.h>
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
Timestamp_Control CPU_usage_Uptime_at_last_reset;
|
||||||
Timestamp_Control CPU_usage_Uptime_at_last_reset;
|
|
||||||
#else
|
|
||||||
uint32_t CPU_usage_Ticks_at_last_reset;
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -44,12 +44,8 @@ void rtems_cpu_usage_report_with_plugin(
|
|||||||
Objects_Information *information;
|
Objects_Information *information;
|
||||||
char name[13];
|
char name[13];
|
||||||
uint32_t ival, fval;
|
uint32_t ival, fval;
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
Timestamp_Control uptime, total, ran, uptime_at_last_reset;
|
||||||
Timestamp_Control uptime, total, ran, uptime_at_last_reset;
|
uint32_t seconds, nanoseconds;
|
||||||
uint32_t seconds, nanoseconds;
|
|
||||||
#else
|
|
||||||
uint32_t total_units = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( !print )
|
if ( !print )
|
||||||
return;
|
return;
|
||||||
@@ -59,38 +55,15 @@ void rtems_cpu_usage_report_with_plugin(
|
|||||||
* the number of "ticks" we gave credit for to give the user a rough
|
* the number of "ticks" we gave credit for to give the user a rough
|
||||||
* guideline as to what each number means proportionally.
|
* guideline as to what each number means proportionally.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timestamp_Set_to_zero( &total );
|
||||||
_Timestamp_Set_to_zero( &total );
|
uptime_at_last_reset = CPU_usage_Uptime_at_last_reset;
|
||||||
uptime_at_last_reset = CPU_usage_Uptime_at_last_reset;
|
|
||||||
#else
|
|
||||||
for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) {
|
|
||||||
#if !defined(RTEMS_POSIX_API) || defined(RTEMS_DEBUG)
|
|
||||||
if ( !_Objects_Information_table[ api_index ] )
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
information = _Objects_Information_table[ api_index ][ 1 ];
|
|
||||||
if ( information ) {
|
|
||||||
for ( i=1 ; i <= information->maximum ; i++ ) {
|
|
||||||
the_thread = (Thread_Control *)information->local_table[ i ];
|
|
||||||
|
|
||||||
if ( the_thread )
|
|
||||||
total_units += the_thread->cpu_time_used;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
(*print)(
|
(*print)(
|
||||||
context,
|
context,
|
||||||
"-------------------------------------------------------------------------------\n"
|
"-------------------------------------------------------------------------------\n"
|
||||||
" CPU USAGE BY THREAD\n"
|
" CPU USAGE BY THREAD\n"
|
||||||
"------------+----------------------------------------+---------------+---------\n"
|
"------------+----------------------------------------+---------------+---------\n"
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
" ID | NAME | SECONDS | PERCENT\n"
|
||||||
" ID | NAME | SECONDS | PERCENT\n"
|
|
||||||
#else
|
|
||||||
" ID | NAME | TICKS | PERCENT\n"
|
|
||||||
#endif
|
|
||||||
"------------+----------------------------------------+---------------+---------\n"
|
"------------+----------------------------------------+---------------+---------\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -117,7 +90,6 @@ void rtems_cpu_usage_report_with_plugin(
|
|||||||
name
|
name
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
{
|
{
|
||||||
Timestamp_Control last;
|
Timestamp_Control last;
|
||||||
|
|
||||||
@@ -150,52 +122,20 @@ void rtems_cpu_usage_report_with_plugin(
|
|||||||
ival, fval
|
ival, fval
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (total_units) {
|
|
||||||
uint64_t ival_64;
|
|
||||||
|
|
||||||
ival_64 = the_thread->cpu_time_used;
|
|
||||||
ival_64 *= 100000;
|
|
||||||
ival = ival_64 / total_units;
|
|
||||||
} else {
|
|
||||||
ival = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fval = ival % 1000;
|
|
||||||
ival /= 1000;
|
|
||||||
(*print)( context,
|
|
||||||
"%14" PRIu32 " |%4" PRIu32 ".%03" PRIu32 "\n",
|
|
||||||
the_thread->cpu_time_used,
|
|
||||||
ival,
|
|
||||||
fval
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
seconds = _Timestamp_Get_seconds( &total );
|
||||||
seconds = _Timestamp_Get_seconds( &total );
|
nanoseconds = _Timestamp_Get_nanoseconds( &total ) /
|
||||||
nanoseconds = _Timestamp_Get_nanoseconds( &total ) /
|
TOD_NANOSECONDS_PER_MICROSECOND;
|
||||||
TOD_NANOSECONDS_PER_MICROSECOND;
|
(*print)(
|
||||||
(*print)(
|
context,
|
||||||
context,
|
"------------+----------------------------------------+---------------+---------\n"
|
||||||
"------------+----------------------------------------+---------------+---------\n"
|
" TIME SINCE LAST CPU USAGE RESET IN SECONDS: %7" PRIu32 ".%06" PRIu32 "\n"
|
||||||
" TIME SINCE LAST CPU USAGE RESET IN SECONDS: %7" PRIu32 ".%06" PRIu32 "\n"
|
"-------------------------------------------------------------------------------\n",
|
||||||
"-------------------------------------------------------------------------------\n",
|
seconds, nanoseconds
|
||||||
seconds, nanoseconds
|
);
|
||||||
);
|
|
||||||
#else
|
|
||||||
(*print)(
|
|
||||||
context,
|
|
||||||
"------------+----------------------------------------+---------------+---------\n"
|
|
||||||
" TICKS SINCE LAST SYSTEM RESET: %14" PRIu32 "\n"
|
|
||||||
" TOTAL UNITS: %14" PRIu32 "\n"
|
|
||||||
"-------------------------------------------------------------------------------\n",
|
|
||||||
_Watchdog_Ticks_since_boot - CPU_usage_Ticks_at_last_reset,
|
|
||||||
total_units
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtems_cpu_usage_report( void )
|
void rtems_cpu_usage_report( void )
|
||||||
|
|||||||
@@ -27,11 +27,7 @@ static void CPU_usage_Per_thread_handler(
|
|||||||
Thread_Control *the_thread
|
Thread_Control *the_thread
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
|
||||||
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
|
|
||||||
#else
|
|
||||||
the_thread->cpu_time_used = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -39,21 +35,17 @@ static void CPU_usage_Per_thread_handler(
|
|||||||
*/
|
*/
|
||||||
void rtems_cpu_usage_reset( void )
|
void rtems_cpu_usage_reset( void )
|
||||||
{
|
{
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
uint32_t cpu_count;
|
||||||
uint32_t cpu_count;
|
uint32_t cpu_index;
|
||||||
uint32_t cpu_index;
|
|
||||||
|
|
||||||
_TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
|
_TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
|
||||||
|
|
||||||
cpu_count = rtems_get_processor_count();
|
cpu_count = rtems_get_processor_count();
|
||||||
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
|
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
|
||||||
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
|
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
|
||||||
|
|
||||||
cpu->time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
|
cpu->time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
|
rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,31 +144,14 @@ static inline bool less_than_uint32_t( uint32_t * lhs, uint32_t * rhs )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#define CPU_usage_Equal_to( _lhs, _rhs ) \
|
||||||
#define CPU_usage_Equal_to( _lhs, _rhs ) \
|
_Timestamp_Equal_to( _lhs, _rhs )
|
||||||
_Timestamp_Equal_to( _lhs, _rhs )
|
|
||||||
#else
|
|
||||||
#define CPU_usage_Equal_to( _lhs, _rhs ) \
|
|
||||||
equal_to_uint32_t( _lhs, _rhs )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#define CPU_usage_Set_to_zero( _time ) \
|
||||||
#define CPU_usage_Set_to_zero( _time ) \
|
_Timestamp_Set_to_zero( _time )
|
||||||
_Timestamp_Set_to_zero( _time )
|
|
||||||
#else
|
|
||||||
#define CPU_usage_Set_to_zero( _time ) \
|
|
||||||
do { \
|
|
||||||
*_time = 0; \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#define CPU_usage_Less_than( _lhs, _rhs ) \
|
||||||
#define CPU_usage_Less_than( _lhs, _rhs ) \
|
_Timestamp_Less_than( _lhs, _rhs )
|
||||||
_Timestamp_Less_than( _lhs, _rhs )
|
|
||||||
#else
|
|
||||||
#define CPU_usage_Less_than( _lhs, _rhs ) \
|
|
||||||
less_than_uint32_t( _lhs, _rhs )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_memsize(rtems_cpu_usage_data* data, const uint32_t size, const char* label)
|
print_memsize(rtems_cpu_usage_data* data, const uint32_t size, const char* label)
|
||||||
@@ -581,11 +564,6 @@ void rtems_cpu_usage_top_with_plugin(
|
|||||||
rtems_printk_plugin_t print
|
rtems_printk_plugin_t print
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
if ( !print )
|
|
||||||
return;
|
|
||||||
(*print)(context, "error: tick kernels not supported\n");
|
|
||||||
#else
|
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
rtems_task_priority priority;
|
rtems_task_priority priority;
|
||||||
rtems_name name;
|
rtems_name name;
|
||||||
@@ -714,7 +692,6 @@ void rtems_cpu_usage_top_with_plugin(
|
|||||||
rtems_event_send(id, RTEMS_EVENT_1);
|
rtems_event_send(id, RTEMS_EVENT_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtems_cpu_usage_top( void )
|
void rtems_cpu_usage_top( void )
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#include <rtems/score/timestamp.h>
|
||||||
#include <rtems/score/timestamp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup libmisc_cpuuse CPU Usage
|
* @defgroup libmisc_cpuuse CPU Usage
|
||||||
@@ -39,11 +37,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
|
||||||
extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
|
|
||||||
#else
|
|
||||||
extern uint32_t CPU_usage_Ticks_at_last_reset;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rtems_cpu_usage_report_with_handler
|
* rtems_cpu_usage_report_with_handler
|
||||||
|
|||||||
@@ -62,25 +62,17 @@ extern "C" {
|
|||||||
* This is the public type used for the rate monotonic timing
|
* This is the public type used for the rate monotonic timing
|
||||||
* statistics.
|
* statistics.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#include <rtems/score/timespec.h>
|
||||||
#include <rtems/score/timespec.h>
|
|
||||||
|
|
||||||
typedef struct timespec rtems_rate_monotonic_period_time_t;
|
typedef struct timespec rtems_rate_monotonic_period_time_t;
|
||||||
#else
|
|
||||||
typedef uint32_t rtems_rate_monotonic_period_time_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the internal type used for the rate monotonic timing
|
* This is the internal type used for the rate monotonic timing
|
||||||
* statistics.
|
* statistics.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#include <rtems/score/timestamp.h>
|
||||||
#include <rtems/score/timestamp.h>
|
|
||||||
|
|
||||||
typedef Timestamp_Control Rate_monotonic_Period_time_t;
|
typedef Timestamp_Control Rate_monotonic_Period_time_t;
|
||||||
#else
|
|
||||||
typedef uint32_t Rate_monotonic_Period_time_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following enumerated type defines the states in which a
|
* The following enumerated type defines the states in which a
|
||||||
|
|||||||
@@ -201,46 +201,30 @@ void _Rate_monotonic_Initiate_statistics(
|
|||||||
*
|
*
|
||||||
* This method resets the statistics information for a period instance.
|
* This method resets the statistics information for a period instance.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
|
||||||
#define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
|
do { \
|
||||||
do { \
|
/* set the minimums to a large value */ \
|
||||||
/* set the minimums to a large value */ \
|
_Timestamp_Set( \
|
||||||
_Timestamp_Set( \
|
&(_the_period)->Statistics.min_wall_time, \
|
||||||
&(_the_period)->Statistics.min_wall_time, \
|
0x7fffffff, \
|
||||||
0x7fffffff, \
|
0x7fffffff \
|
||||||
0x7fffffff \
|
); \
|
||||||
); \
|
} while (0)
|
||||||
} while (0)
|
|
||||||
#else
|
|
||||||
#define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
|
|
||||||
do { \
|
|
||||||
/* set the minimum to a large value */ \
|
|
||||||
(_the_period)->Statistics.min_wall_time = 0xffffffff; \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Rate_monotonic_Reset_cpu_use_statistics
|
* @brief Rate_monotonic_Reset_cpu_use_statistics
|
||||||
*
|
*
|
||||||
* This helper method resets the period CPU usage statistics structure.
|
* This helper method resets the period CPU usage statistics structure.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
|
||||||
#define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
|
do { \
|
||||||
do { \
|
/* set the minimums to a large value */ \
|
||||||
/* set the minimums to a large value */ \
|
_Timestamp_Set( \
|
||||||
_Timestamp_Set( \
|
&(_the_period)->Statistics.min_cpu_time, \
|
||||||
&(_the_period)->Statistics.min_cpu_time, \
|
0x7fffffff, \
|
||||||
0x7fffffff, \
|
0x7fffffff \
|
||||||
0x7fffffff \
|
); \
|
||||||
); \
|
} while (0)
|
||||||
} while (0)
|
|
||||||
#else
|
|
||||||
#define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
|
|
||||||
do { \
|
|
||||||
/* set the minimum to a large value */ \
|
|
||||||
(_the_period)->Statistics.min_cpu_time = 0xffffffff; \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Rate_monotonic_Reset_statistics
|
* @brief Rate_monotonic_Reset_statistics
|
||||||
|
|||||||
@@ -124,11 +124,7 @@ typedef Watchdog_Interval rtems_interval;
|
|||||||
* When using nanoseconds granularity timing, RTEMS may internally use a
|
* When using nanoseconds granularity timing, RTEMS may internally use a
|
||||||
* variety of representations.
|
* variety of representations.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
typedef struct timespec rtems_thread_cpu_usage_t;
|
||||||
typedef struct timespec rtems_thread_cpu_usage_t;
|
|
||||||
#else
|
|
||||||
typedef uint32_t rtems_thread_cpu_usage_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Data structure to manage and manipulate calendar
|
* @brief Data structure to manage and manipulate calendar
|
||||||
|
|||||||
@@ -46,21 +46,12 @@ rtems_status_code rtems_rate_monotonic_get_statistics(
|
|||||||
src = &the_period->Statistics;
|
src = &the_period->Statistics;
|
||||||
dst->count = src->count;
|
dst->count = src->count;
|
||||||
dst->missed_count = src->missed_count;
|
dst->missed_count = src->missed_count;
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timestamp_To_timespec( &src->min_cpu_time, &dst->min_cpu_time );
|
||||||
_Timestamp_To_timespec( &src->min_cpu_time, &dst->min_cpu_time );
|
_Timestamp_To_timespec( &src->max_cpu_time, &dst->max_cpu_time );
|
||||||
_Timestamp_To_timespec( &src->max_cpu_time, &dst->max_cpu_time );
|
_Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
|
||||||
_Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
|
_Timestamp_To_timespec( &src->min_wall_time, &dst->min_wall_time );
|
||||||
_Timestamp_To_timespec( &src->min_wall_time, &dst->min_wall_time );
|
_Timestamp_To_timespec( &src->max_wall_time, &dst->max_wall_time );
|
||||||
_Timestamp_To_timespec( &src->max_wall_time, &dst->max_wall_time );
|
_Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
|
||||||
_Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
|
|
||||||
#else
|
|
||||||
dst->min_cpu_time = src->min_cpu_time;
|
|
||||||
dst->max_cpu_time = src->max_cpu_time;
|
|
||||||
dst->total_cpu_time = src->total_cpu_time;
|
|
||||||
dst->min_wall_time = src->min_wall_time;
|
|
||||||
dst->max_wall_time = src->max_wall_time;
|
|
||||||
dst->total_wall_time = src->total_wall_time;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_Objects_Put( &the_period->Object );
|
_Objects_Put( &the_period->Object );
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|||||||
@@ -24,10 +24,7 @@
|
|||||||
#include <rtems/score/isr.h>
|
#include <rtems/score/isr.h>
|
||||||
#include <rtems/rtems/ratemonimpl.h>
|
#include <rtems/rtems/ratemonimpl.h>
|
||||||
#include <rtems/score/thread.h>
|
#include <rtems/score/thread.h>
|
||||||
|
#include <rtems/score/timespec.h>
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
#include <rtems/score/timespec.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rtems_status_code rtems_rate_monotonic_get_status(
|
rtems_status_code rtems_rate_monotonic_get_status(
|
||||||
rtems_id id,
|
rtems_id id,
|
||||||
@@ -54,14 +51,8 @@ rtems_status_code rtems_rate_monotonic_get_status(
|
|||||||
* If the period is inactive, there is no information.
|
* If the period is inactive, there is no information.
|
||||||
*/
|
*/
|
||||||
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
|
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timespec_Set_to_zero( &status->since_last_period );
|
||||||
_Timespec_Set_to_zero( &status->since_last_period );
|
_Timespec_Set_to_zero( &status->executed_since_last_period );
|
||||||
_Timespec_Set_to_zero( &status->executed_since_last_period );
|
|
||||||
#else
|
|
||||||
status->since_last_period = 0;
|
|
||||||
status->executed_since_last_period = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -76,17 +67,12 @@ rtems_status_code rtems_rate_monotonic_get_status(
|
|||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timestamp_To_timespec(
|
||||||
_Timestamp_To_timespec(
|
&since_last_period, &status->since_last_period
|
||||||
&since_last_period, &status->since_last_period
|
);
|
||||||
);
|
_Timestamp_To_timespec(
|
||||||
_Timestamp_To_timespec(
|
&executed, &status->executed_since_last_period
|
||||||
&executed, &status->executed_since_last_period
|
);
|
||||||
);
|
|
||||||
#else
|
|
||||||
status->since_last_period = since_last_period;
|
|
||||||
status->executed_since_last_period = executed;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_Objects_Put( &the_period->Object );
|
_Objects_Put( &the_period->Object );
|
||||||
|
|||||||
@@ -30,67 +30,50 @@ bool _Rate_monotonic_Get_status(
|
|||||||
Thread_CPU_usage_t *cpu_since_last_period
|
Thread_CPU_usage_t *cpu_since_last_period
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
Timestamp_Control uptime;
|
||||||
Timestamp_Control uptime;
|
Thread_Control *owning_thread = the_period->owner;
|
||||||
#endif
|
Thread_CPU_usage_t used;
|
||||||
Thread_Control *owning_thread = the_period->owner;
|
|
||||||
Thread_CPU_usage_t used;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine elapsed wall time since period initiated.
|
* Determine elapsed wall time since period initiated.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_TOD_Get_uptime( &uptime );
|
||||||
_TOD_Get_uptime( &uptime );
|
_Timestamp_Subtract(
|
||||||
_Timestamp_Subtract(
|
&the_period->time_period_initiated, &uptime, wall_since_last_period
|
||||||
&the_period->time_period_initiated, &uptime, wall_since_last_period
|
);
|
||||||
);
|
|
||||||
#else
|
|
||||||
*wall_since_last_period =
|
|
||||||
_Watchdog_Ticks_since_boot - the_period->time_period_initiated;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine cpu usage since period initiated.
|
* Determine cpu usage since period initiated.
|
||||||
*/
|
*/
|
||||||
used = owning_thread->cpu_time_used;
|
used = owning_thread->cpu_time_used;
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
if (owning_thread == _Thread_Executing) {
|
||||||
if (owning_thread == _Thread_Executing) {
|
|
||||||
|
|
||||||
Thread_CPU_usage_t ran;
|
Thread_CPU_usage_t ran;
|
||||||
|
|
||||||
/* How much time time since last context switch */
|
/* How much time time since last context switch */
|
||||||
_Timestamp_Subtract(
|
_Timestamp_Subtract(
|
||||||
&_Thread_Time_of_last_context_switch, &uptime, &ran
|
&_Thread_Time_of_last_context_switch, &uptime, &ran
|
||||||
);
|
);
|
||||||
|
|
||||||
/* cpu usage += ran */
|
/* cpu usage += ran */
|
||||||
_Timestamp_Add_to( &used, &ran );
|
_Timestamp_Add_to( &used, &ran );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The cpu usage info was reset while executing. Can't
|
* The cpu usage info was reset while executing. Can't
|
||||||
* determine a status.
|
* determine a status.
|
||||||
*/
|
*/
|
||||||
if (_Timestamp_Less_than(&used, &the_period->cpu_usage_period_initiated))
|
if (_Timestamp_Less_than(&used, &the_period->cpu_usage_period_initiated))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* used = current cpu usage - cpu usage at start of period */
|
/* used = current cpu usage - cpu usage at start of period */
|
||||||
_Timestamp_Subtract(
|
_Timestamp_Subtract(
|
||||||
&the_period->cpu_usage_period_initiated,
|
&the_period->cpu_usage_period_initiated,
|
||||||
&used,
|
&used,
|
||||||
cpu_since_last_period
|
cpu_since_last_period
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/*
|
|
||||||
* The cpu usage info was reset while executing. Can't
|
|
||||||
* determine a status.
|
|
||||||
*/
|
|
||||||
if (used < the_period->cpu_usage_period_initiated)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*cpu_since_last_period = used - the_period->cpu_usage_period_initiated;
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,10 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
/* We print to 1/10's of milliseconds */
|
||||||
/* We print to 1/10's of milliseconds */
|
#define NANOSECONDS_DIVIDER 1000
|
||||||
#define NANOSECONDS_DIVIDER 1000
|
#define PERCENT_FMT "%04" PRId32
|
||||||
#define PERCENT_FMT "%04" PRId32
|
#define NANOSECONDS_FMT "%06" PRId32
|
||||||
#define NANOSECONDS_FMT "%06" PRId32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void rtems_rate_monotonic_report_statistics_with_plugin(
|
void rtems_rate_monotonic_report_statistics_with_plugin(
|
||||||
void *context,
|
void *context,
|
||||||
@@ -45,10 +43,8 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
(*print)( context, "Period information by period\n" );
|
(*print)( context, "Period information by period\n" );
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
(*print)( context, "--- CPU times are in seconds ---\n" );
|
||||||
(*print)( context, "--- CPU times are in seconds ---\n" );
|
(*print)( context, "--- Wall times are in seconds ---\n" );
|
||||||
(*print)( context, "--- Wall times are in seconds ---\n" );
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
Layout by columns -- in memory of Hollerith :)
|
Layout by columns -- in memory of Hollerith :)
|
||||||
|
|
||||||
@@ -62,25 +58,11 @@ ididididid NNNN ccccc mmmmmm X
|
|||||||
1234567890123456789012345678901234567890123456789012345678901234567890123456789\
|
1234567890123456789012345678901234567890123456789012345678901234567890123456789\
|
||||||
\n");
|
\n");
|
||||||
*/
|
*/
|
||||||
(*print)( context, " ID OWNER COUNT MISSED "
|
(*print)( context,
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
" ID OWNER COUNT MISSED "
|
||||||
" "
|
" CPU TIME WALL TIME\n"
|
||||||
#endif
|
" "
|
||||||
"CPU TIME "
|
" MIN/MAX/AVG MIN/MAX/AVG\n"
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
" "
|
|
||||||
#endif
|
|
||||||
" WALL TIME\n"
|
|
||||||
);
|
|
||||||
(*print)( context, " "
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
" "
|
|
||||||
#endif
|
|
||||||
"MIN/MAX/AVG "
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
" "
|
|
||||||
#endif
|
|
||||||
" MIN/MAX/AVG\n"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -126,7 +108,6 @@ ididididid NNNN ccccc mmmmmm X
|
|||||||
* print CPU Usage part of statistics
|
* print CPU Usage part of statistics
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
struct timespec cpu_average;
|
struct timespec cpu_average;
|
||||||
struct timespec *min_cpu = &the_stats.min_cpu_time;
|
struct timespec *min_cpu = &the_stats.min_cpu_time;
|
||||||
struct timespec *max_cpu = &the_stats.max_cpu_time;
|
struct timespec *max_cpu = &the_stats.max_cpu_time;
|
||||||
@@ -144,25 +125,12 @@ ididididid NNNN ccccc mmmmmm X
|
|||||||
_Timespec_Get_seconds( &cpu_average ),
|
_Timespec_Get_seconds( &cpu_average ),
|
||||||
_Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
|
_Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
uint32_t ival_cpu, fval_cpu;
|
|
||||||
|
|
||||||
ival_cpu = the_stats.total_cpu_time * 100 / the_stats.count;
|
|
||||||
fval_cpu = ival_cpu % 100;
|
|
||||||
ival_cpu /= 100;
|
|
||||||
|
|
||||||
(*print)( context,
|
|
||||||
"%3" PRId32 "/%4" PRId32 "/%3" PRId32 ".%02" PRId32 " ",
|
|
||||||
the_stats.min_cpu_time, the_stats.max_cpu_time, ival_cpu, fval_cpu
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* print wall time part of statistics
|
* print wall time part of statistics
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
struct timespec wall_average;
|
struct timespec wall_average;
|
||||||
struct timespec *min_wall = &the_stats.min_wall_time;
|
struct timespec *min_wall = &the_stats.min_wall_time;
|
||||||
struct timespec *max_wall = &the_stats.max_wall_time;
|
struct timespec *max_wall = &the_stats.max_wall_time;
|
||||||
@@ -180,17 +148,6 @@ ididididid NNNN ccccc mmmmmm X
|
|||||||
_Timespec_Get_seconds( &wall_average ),
|
_Timespec_Get_seconds( &wall_average ),
|
||||||
_Timespec_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER
|
_Timespec_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
uint32_t ival_wall, fval_wall;
|
|
||||||
|
|
||||||
ival_wall = the_stats.total_wall_time * 100 / the_stats.count;
|
|
||||||
fval_wall = ival_wall % 100;
|
|
||||||
ival_wall /= 100;
|
|
||||||
(*print)( context,
|
|
||||||
"%3" PRId32 "/%4" PRId32 "/%3" PRId32 ".%02" PRId32 "\n",
|
|
||||||
the_stats.min_wall_time, the_stats.max_wall_time, ival_wall, fval_wall
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,13 +83,9 @@ extern "C" {
|
|||||||
* The user can define this at configure time and go back to ticks
|
* The user can define this at configure time and go back to ticks
|
||||||
* resolution.
|
* resolution.
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
#include <rtems/score/timestamp.h>
|
||||||
#include <rtems/score/timestamp.h>
|
|
||||||
|
|
||||||
typedef Timestamp_Control Thread_CPU_usage_t;
|
typedef Timestamp_Control Thread_CPU_usage_t;
|
||||||
#else
|
|
||||||
typedef uint32_t Thread_CPU_usage_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following defines the "return type" of a thread.
|
* The following defines the "return type" of a thread.
|
||||||
|
|||||||
@@ -31,13 +31,6 @@ void _Scheduler_default_Tick(
|
|||||||
{
|
{
|
||||||
(void) scheduler;
|
(void) scheduler;
|
||||||
|
|
||||||
#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
/*
|
|
||||||
* Increment the number of ticks this thread has been executing
|
|
||||||
*/
|
|
||||||
executing->cpu_time_used++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the thread is not preemptible or is not ready, then
|
* If the thread is not preemptible or is not ready, then
|
||||||
* just return.
|
* just return.
|
||||||
|
|||||||
@@ -99,17 +99,10 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level )
|
|||||||
_ISR_Enable( level );
|
_ISR_Enable( level );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Thread_Update_cpu_time_used(
|
||||||
_Thread_Update_cpu_time_used(
|
executing,
|
||||||
executing,
|
&cpu_self->time_of_last_context_switch
|
||||||
&cpu_self->time_of_last_context_switch
|
);
|
||||||
);
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
_TOD_Get_uptime( &cpu_self->time_of_last_context_switch );
|
|
||||||
heir->cpu_time_used++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__DYNAMIC_REENT__)
|
#if !defined(__DYNAMIC_REENT__)
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -217,11 +217,7 @@ bool _Thread_Initialize(
|
|||||||
/*
|
/*
|
||||||
* Initialize the CPU usage statistics
|
* Initialize the CPU usage statistics
|
||||||
*/
|
*/
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
|
||||||
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
|
|
||||||
#else
|
|
||||||
the_thread->cpu_time_used = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize thread's key vaule node chain
|
* initialize thread's key vaule node chain
|
||||||
|
|||||||
@@ -55,15 +55,10 @@ rtems_task Init(
|
|||||||
/* Check status values. */
|
/* Check status values. */
|
||||||
rtems_test_assert( period_status.owner == rtems_task_self() );
|
rtems_test_assert( period_status.owner == rtems_task_self() );
|
||||||
rtems_test_assert( period_status.state == RATE_MONOTONIC_INACTIVE );
|
rtems_test_assert( period_status.state == RATE_MONOTONIC_INACTIVE );
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
|
||||||
rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
|
rtems_test_assert( period_status.since_last_period.tv_nsec == 0 );
|
||||||
rtems_test_assert( period_status.since_last_period.tv_nsec == 0 );
|
rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
|
||||||
rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
|
rtems_test_assert( period_status.executed_since_last_period.tv_nsec == 0 );
|
||||||
rtems_test_assert( period_status.executed_since_last_period.tv_nsec == 0 );
|
|
||||||
#else
|
|
||||||
rtems_test_assert( period_status.since_last_period == 0 );
|
|
||||||
rtems_test_assert( period_status.executed_since_last_period == 0 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check get_status error cases.
|
* Check get_status error cases.
|
||||||
@@ -113,40 +108,25 @@ rtems_task Init(
|
|||||||
directive_failed( status, "rate_monotonic_get_status" );
|
directive_failed( status, "rate_monotonic_get_status" );
|
||||||
|
|
||||||
/* Check status values. */
|
/* Check status values. */
|
||||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
|
||||||
/* Note: POSIX mandates struct timespec->tv_nsec to be a "long" */
|
/* Note: POSIX mandates struct timespec->tv_nsec to be a "long" */
|
||||||
printf(
|
printf(
|
||||||
"wall time should be ~600000000 is %ld\n",
|
"wall time should be ~600000000 is %ld\n",
|
||||||
period_status.since_last_period.tv_nsec
|
period_status.since_last_period.tv_nsec
|
||||||
);
|
);
|
||||||
printf(
|
printf(
|
||||||
"cpu time should be ~100000000 is %ld\n",
|
"cpu time should be ~100000000 is %ld\n",
|
||||||
period_status.executed_since_last_period.tv_nsec
|
period_status.executed_since_last_period.tv_nsec
|
||||||
);
|
);
|
||||||
rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
|
rtems_test_assert( period_status.since_last_period.tv_sec == 0 );
|
||||||
rtems_test_assert( period_status.since_last_period.tv_nsec >= 600000000 );
|
rtems_test_assert( period_status.since_last_period.tv_nsec >= 600000000 );
|
||||||
rtems_test_assert( period_status.since_last_period.tv_nsec <= 610000000 );
|
rtems_test_assert( period_status.since_last_period.tv_nsec <= 610000000 );
|
||||||
rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
|
rtems_test_assert( period_status.executed_since_last_period.tv_sec == 0 );
|
||||||
rtems_test_assert(
|
rtems_test_assert(
|
||||||
period_status.executed_since_last_period.tv_nsec >= 100000000
|
period_status.executed_since_last_period.tv_nsec >= 100000000
|
||||||
);
|
);
|
||||||
rtems_test_assert(
|
rtems_test_assert(
|
||||||
period_status.executed_since_last_period.tv_nsec <= 110000000
|
period_status.executed_since_last_period.tv_nsec <= 110000000
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
printf(
|
|
||||||
"wall time should be ~60 is %" PRId32 "\n",
|
|
||||||
(int) period_status.since_last_period
|
|
||||||
);
|
|
||||||
printf(
|
|
||||||
"cpu time should be ~10 is %" PRId32 "\n",
|
|
||||||
(int) period_status.executed_since_last_period
|
|
||||||
);
|
|
||||||
rtems_test_assert( period_status.since_last_period >= 60 );
|
|
||||||
rtems_test_assert( period_status.since_last_period <= 61 );
|
|
||||||
rtems_test_assert( period_status.executed_since_last_period >= 10 );
|
|
||||||
rtems_test_assert( period_status.executed_since_last_period <= 12 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ensure the missed periods are properly accounted for */
|
/* ensure the missed periods are properly accounted for */
|
||||||
puts( "rtems_rate_monotonic_cancel - OK" );
|
puts( "rtems_rate_monotonic_cancel - OK" );
|
||||||
|
|||||||
Reference in New Issue
Block a user