mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 06:08:20 +00:00
2009-12-02 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* configure.ac, libcsupport/src/__times.c, libmisc/cpuuse/cpuusagedata.c, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/types.h, rtems/src/ratemongetstatistics.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c, rtems/src/ratemonreportstatistics.c, score/include/rtems/score/thread.h, score/src/threaddispatch.c, score/src/threadinitialize.c, score/src/threadtickletimeslice.c: Changed the configuration of statistics granularity to use just one define.
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
2009-12-02 Glenn Humphrey <glenn.humphrey@OARcorp.com>
|
||||
|
||||
* configure.ac, libcsupport/src/__times.c,
|
||||
libmisc/cpuuse/cpuusagedata.c, libmisc/cpuuse/cpuusagereport.c,
|
||||
libmisc/cpuuse/cpuusagereset.c, rtems/include/rtems/rtems/ratemon.h,
|
||||
rtems/include/rtems/rtems/types.h, rtems/src/ratemongetstatistics.c,
|
||||
rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c,
|
||||
rtems/src/ratemonreportstatistics.c,
|
||||
score/include/rtems/score/thread.h, score/src/threaddispatch.c,
|
||||
score/src/threadinitialize.c, score/src/threadtickletimeslice.c:
|
||||
Changed the configuration of statistics granularity to use just one
|
||||
define.
|
||||
|
||||
2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* shttpd/def.h: Use __m32c__ for m32c.
|
||||
|
||||
@@ -154,6 +154,11 @@ RTEMS_CPUOPT([RTEMS_VERSION],
|
||||
["]_RTEMS_VERSION["],
|
||||
[RTEMS version string])
|
||||
|
||||
RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
|
||||
[test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
|
||||
[1],
|
||||
[disable nanosecond granularity for statistics])
|
||||
|
||||
RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__],
|
||||
[test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"],
|
||||
[1],
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timestamp.h>
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ clock_t _times(
|
||||
* this thread.
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
{
|
||||
Timestamp_Control per_tick;
|
||||
uint32_t ticks;
|
||||
|
||||
@@ -16,18 +16,13 @@
|
||||
#endif
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include <rtems/cpuuse.h>
|
||||
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timespec.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
struct timespec CPU_usage_Uptime_at_last_reset;
|
||||
#else
|
||||
uint32_t CPU_usage_Ticks_at_last_reset;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <rtems/cpuuse.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timestamp.h>
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
|
||||
#else
|
||||
extern uint32_t CPU_usage_Ticks_at_last_reset;
|
||||
@@ -53,7 +53,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
Objects_Information *information;
|
||||
char name[13];
|
||||
uint32_t ival, fval;
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
Timestamp_Control uptime, total, ran;
|
||||
#else
|
||||
uint32_t total_units = 0;
|
||||
@@ -67,7 +67,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
* the number of "ticks" we gave credit for to give the user a rough
|
||||
* guideline as to what each number means proportionally.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_TOD_Get_uptime( &uptime );
|
||||
_Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total );
|
||||
#else
|
||||
@@ -91,7 +91,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
"-------------------------------------------------------------------------------\n"
|
||||
" CPU USAGE BY THREAD\n"
|
||||
"------------+----------------------------------------+---------------+---------\n"
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
" ID | NAME | SECONDS | PERCENT\n"
|
||||
#else
|
||||
" ID | NAME | TICKS | PERCENT\n"
|
||||
@@ -121,7 +121,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
name
|
||||
);
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
/*
|
||||
* If this is the currently executing thread, account for time
|
||||
* since the last context switch.
|
||||
@@ -152,7 +152,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
uint64_t ival_64;
|
||||
|
||||
ival_64 = the_thread->cpu_time_used;
|
||||
ival_64 *= 10000;
|
||||
ival_64 *= 100000;
|
||||
ival = ival_64 / total_units;
|
||||
} else {
|
||||
ival = 0;
|
||||
@@ -171,7 +171,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
(*print)(
|
||||
context,
|
||||
"------------+----------------------------------------+---------------+---------\n"
|
||||
|
||||
@@ -28,18 +28,17 @@ static void CPU_usage_Per_thread_handler(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
|
||||
#else
|
||||
the_thread->cpu_time_used = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* External data that is shared by cpu usage code but not declared in .h files.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
|
||||
#else
|
||||
extern uint32_t CPU_usage_Ticks_at_last_reset;
|
||||
@@ -50,7 +49,7 @@ static void CPU_usage_Per_thread_handler(
|
||||
*/
|
||||
void rtems_cpu_usage_reset( void )
|
||||
{
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
|
||||
_Thread_Time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
|
||||
#else
|
||||
|
||||
@@ -54,25 +54,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The user can define this at configure time and go back to ticks
|
||||
* resolution.
|
||||
*/
|
||||
#if !defined(__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__)
|
||||
/**
|
||||
* Enable the nanosecond accurate statistics
|
||||
*
|
||||
* When not defined, the older style tick accurate granularity
|
||||
* is used.
|
||||
*/
|
||||
#define RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the public type used for the rate monotonic timing
|
||||
* statistics.
|
||||
*/
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timespec.h>
|
||||
|
||||
typedef struct timespec rtems_rate_monotonic_period_time_t;
|
||||
@@ -84,7 +70,7 @@ extern "C" {
|
||||
* This is the internal type used for the rate monotonic timing
|
||||
* statistics.
|
||||
*/
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timestamp.h>
|
||||
|
||||
typedef Timestamp_Control Rate_monotonic_Period_time_t;
|
||||
@@ -435,7 +421,7 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
*
|
||||
* This method resets the statistics information for a period instance.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
|
||||
do { \
|
||||
/* set the minimums to a large value */ \
|
||||
@@ -458,7 +444,7 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
*
|
||||
* This helper method resets the period CPU usage statistics structure.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
|
||||
do { \
|
||||
/* set the minimums to a large value */ \
|
||||
|
||||
@@ -124,15 +124,14 @@ typedef Watchdog_Interval rtems_interval;
|
||||
* @brief Represents the CPU usage per thread.
|
||||
*
|
||||
* When using nano seconds granularity timing, RTEMS may internally use a
|
||||
* variety of represenations.
|
||||
* variety of representations.
|
||||
*/
|
||||
#ifndef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
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 time.
|
||||
*/
|
||||
|
||||
@@ -61,21 +61,17 @@ rtems_status_code rtems_rate_monotonic_get_statistics(
|
||||
src = &the_period->Statistics;
|
||||
dst->count = src->count;
|
||||
dst->missed_count = src->missed_count;
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_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->total_cpu_time, &dst->total_cpu_time );
|
||||
#else
|
||||
statistics->min_wall_time = src->min_wall_time;
|
||||
statistics->max_wall_time = src->max_wall_time;
|
||||
statistics->total_wall_time = src->total_wall_time;
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
|
||||
_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->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;
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#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)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timespec.h>
|
||||
#endif
|
||||
|
||||
@@ -52,8 +51,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
|
||||
{
|
||||
Objects_Locations location;
|
||||
Rate_monotonic_Control *the_period;
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
Timestamp_Control uptime;
|
||||
Timestamp_Control temp;
|
||||
#endif
|
||||
@@ -68,36 +66,23 @@ rtems_status_code rtems_rate_monotonic_get_status(
|
||||
status->owner = the_period->owner->Object.id;
|
||||
status->state = the_period->state;
|
||||
|
||||
/*
|
||||
* If the period is inactive, there is no information.
|
||||
*/
|
||||
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_Timespec_Set_to_zero( &status->since_last_period );
|
||||
#else
|
||||
status->since_last_period = 0;
|
||||
#endif
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
_Timespec_Set_to_zero( &status->executed_since_last_period );
|
||||
#else
|
||||
status->since_last_period = 0;
|
||||
status->executed_since_last_period = 0;
|
||||
#endif
|
||||
} else {
|
||||
/*
|
||||
* Both nanoseconds granularity options have to know the uptime.
|
||||
* This lets them share one single invocation of _TOD_Get_uptime().
|
||||
*/
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
_TOD_Get_uptime( &uptime );
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
} else {
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_TOD_Get_uptime( &uptime );
|
||||
_Timestamp_Subtract( &the_period->time_at_period, &uptime, &temp );
|
||||
_Timestamp_To_timespec( &temp, &status->since_last_period );
|
||||
#else
|
||||
status->since_last_period =
|
||||
_Watchdog_Ticks_since_boot - the_period->time_at_period;
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
_Timestamp_Subtract(
|
||||
&_Thread_Time_of_last_context_switch,
|
||||
&uptime,
|
||||
@@ -105,6 +90,8 @@ rtems_status_code rtems_rate_monotonic_get_status(
|
||||
);
|
||||
_Timestamp_To_timespec( &temp, &status->executed_since_last_period );
|
||||
#else
|
||||
status->since_last_period =
|
||||
_Watchdog_Ticks_since_boot - the_period->time_at_period;
|
||||
status->executed_since_last_period =
|
||||
the_period->owner->cpu_time_used -
|
||||
the_period->owner_executed_at_period;
|
||||
|
||||
@@ -30,13 +30,10 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
Thread_Control *owning_thread = the_period->owner;
|
||||
|
||||
/*
|
||||
* If any statistics are at nanosecond granularity, we need to
|
||||
* obtain the uptime.
|
||||
* If using nanosecond statistics, we need to obtain the uptime.
|
||||
*/
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
|
||||
struct timespec uptime;
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
Timestamp_Control uptime;
|
||||
|
||||
_TOD_Get_uptime( &uptime );
|
||||
#endif
|
||||
@@ -44,7 +41,7 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
/*
|
||||
* Set the starting point and the CPU time used for the statistics.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
the_period->time_at_period = uptime;
|
||||
#else
|
||||
the_period->time_at_period = _Watchdog_Ticks_since_boot;
|
||||
@@ -53,14 +50,14 @@ void _Rate_monotonic_Initiate_statistics(
|
||||
the_period->owner_executed_at_period = owning_thread->cpu_time_used;
|
||||
|
||||
/*
|
||||
* If using nanosecond granularity for CPU Usage Statistics and the
|
||||
* period's thread is currently executing, then we need to take into
|
||||
* account how much time the executing thread has run since the last
|
||||
* context switch. When this routine is invoked from
|
||||
* rtems_rate_monotonic_period, the owner will be the executing thread.
|
||||
* When this routine is invoked from _Rate_monotonic_Timeout, it will not.
|
||||
* If using nanosecond statistics and the period's thread is currently
|
||||
* executing, then we need to take into account how much time the
|
||||
* executing thread has run since the last context switch. When this
|
||||
* routine is invoked from rtems_rate_monotonic_period, the owner will
|
||||
* be the executing thread. When this routine is invoked from
|
||||
* _Rate_monotonic_Timeout, it will not.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
if (owning_thread == _Thread_Executing) {
|
||||
|
||||
rtems_thread_cpu_usage_t ran;
|
||||
@@ -85,13 +82,13 @@ void _Rate_monotonic_Update_statistics(
|
||||
Rate_monotonic_Statistics *stats;
|
||||
Thread_CPU_usage_t executed;
|
||||
Rate_monotonic_Period_time_t since_last_period;
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
Timestamp_Control uptime;
|
||||
|
||||
/*
|
||||
* Obtain the current time since boot
|
||||
*/
|
||||
/*
|
||||
* If using nanosecond statistics, we need to obtain the uptime.
|
||||
*/
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
Timestamp_Control uptime;
|
||||
|
||||
_TOD_Get_uptime( &uptime );
|
||||
#endif
|
||||
|
||||
@@ -113,7 +110,7 @@ void _Rate_monotonic_Update_statistics(
|
||||
/*
|
||||
* Grab basic information for time statistics.
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_Timespec_Subtract(
|
||||
&the_period->time_at_period,
|
||||
&uptime,
|
||||
@@ -123,7 +120,7 @@ void _Rate_monotonic_Update_statistics(
|
||||
since_last_period = _Watchdog_Ticks_since_boot - the_period->time_at_period;
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
{
|
||||
Thread_CPU_usage_t ran, used;
|
||||
|
||||
@@ -159,8 +156,7 @@ void _Rate_monotonic_Update_statistics(
|
||||
/*
|
||||
* Update CPU time
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_Timestamp_Add_to( &stats->total_cpu_time, &executed );
|
||||
|
||||
if ( _Timestamp_Less_than( &executed, &stats->min_cpu_time ) )
|
||||
@@ -181,8 +177,15 @@ void _Rate_monotonic_Update_statistics(
|
||||
/*
|
||||
* Update Wall time
|
||||
*/
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_Timestamp_Add_to( &stats->total_wall_time, &since_last_period );
|
||||
|
||||
#ifndef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
if ( _Timestamp_Less_than( &since_last_period, &stats->min_wall_time ) )
|
||||
stats->min_wall_time = since_last_period;
|
||||
|
||||
if ( _Timestamp_Greater_than( &since_last_period, &stats->max_wall_time ) )
|
||||
stats->max_wall_time = since_last_period;
|
||||
#else
|
||||
|
||||
/* Sanity check wall time */
|
||||
if ( since_last_period < executed )
|
||||
@@ -195,14 +198,6 @@ void _Rate_monotonic_Update_statistics(
|
||||
|
||||
if ( since_last_period > stats->max_wall_time )
|
||||
stats->max_wall_time = since_last_period;
|
||||
#else
|
||||
_Timestamp_Add_to( &stats->total_wall_time, &since_last_period );
|
||||
|
||||
if ( _Timestamp_Less_than( &since_last_period, &stats->min_wall_time ) )
|
||||
stats->min_wall_time = since_last_period;
|
||||
|
||||
if ( _Timestamp_Greater_than( &since_last_period, &stats->max_wall_time ) )
|
||||
stats->max_wall_time = since_last_period;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#include <rtems/bspIo.h>
|
||||
#include <rtems/score/timespec.h>
|
||||
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) || \
|
||||
defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
/* We print to 1/10's of milliseconds */
|
||||
#define NANOSECONDS_DIVIDER 1000
|
||||
#define PERCENT_FMT "%04" PRId32
|
||||
@@ -54,10 +53,8 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
|
||||
return;
|
||||
|
||||
(*print)( context, "Period information by period\n" );
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
(*print)( context, "--- CPU times are in seconds ---\n" );
|
||||
#endif
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
|
||||
(*print)( context, "--- Wall times are in seconds ---\n" );
|
||||
#endif
|
||||
/*
|
||||
@@ -74,28 +71,22 @@ ididididid NNNN ccccc mmmmmm X
|
||||
\n");
|
||||
*/
|
||||
(*print)( context, " ID OWNER COUNT MISSED "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
" "
|
||||
#endif
|
||||
"CPU TIME "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
" "
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
" "
|
||||
#endif
|
||||
" WALL TIME\n"
|
||||
);
|
||||
(*print)( context, " "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
" "
|
||||
#endif
|
||||
"MIN/MAX/AVG "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
" "
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
" "
|
||||
#endif
|
||||
" MIN/MAX/AVG\n"
|
||||
);
|
||||
@@ -141,7 +132,7 @@ ididididid NNNN ccccc mmmmmm X
|
||||
* print CPU Usage part of statistics
|
||||
*/
|
||||
{
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
struct timespec cpu_average;
|
||||
struct timespec *min_cpu = &the_stats.min_cpu_time;
|
||||
struct timespec *max_cpu = &the_stats.max_cpu_time;
|
||||
@@ -177,7 +168,7 @@ ididididid NNNN ccccc mmmmmm X
|
||||
* print wall time part of statistics
|
||||
*/
|
||||
{
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
struct timespec wall_average;
|
||||
struct timespec *min_wall = &the_stats.min_wall_time;
|
||||
struct timespec *max_wall = &the_stats.max_wall_time;
|
||||
|
||||
@@ -47,17 +47,9 @@ extern "C" {
|
||||
* The user can define this at configure time and go back to ticks
|
||||
* resolution.
|
||||
*/
|
||||
#ifndef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timestamp.h>
|
||||
|
||||
/**
|
||||
* This macro enables the nanosecond accurate statistics
|
||||
*
|
||||
* When not defined, the older style tick accurate granularity
|
||||
* is used.
|
||||
*/
|
||||
#define RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
|
||||
typedef Timestamp_Control Thread_CPU_usage_t;
|
||||
#else
|
||||
typedef uint32_t Thread_CPU_usage_t;
|
||||
@@ -76,10 +68,6 @@ extern "C" {
|
||||
#include <rtems/score/tqdata.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
/* XXX include something for timespec */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The following defines the "return type" of a thread.
|
||||
*
|
||||
@@ -516,7 +504,7 @@ SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
|
||||
*/
|
||||
SCORE_EXTERN struct _reent **_Thread_libc_reent;
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
|
||||
/**
|
||||
* This contains the time since boot when the last context switch occurred.
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <rtems/score/userext.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
#include <rtems/score/timestamp.h>
|
||||
#endif
|
||||
|
||||
@@ -102,7 +102,7 @@ void _Thread_Dispatch( void )
|
||||
heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
|
||||
_ISR_Enable( level );
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
{
|
||||
Timestamp_Control uptime, ran;
|
||||
_TOD_Get_uptime( &uptime );
|
||||
|
||||
@@ -200,10 +200,10 @@ bool _Thread_Initialize(
|
||||
/*
|
||||
* Initialize the CPU usage statistics
|
||||
*/
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
_Timestamp_Set_to_zero( &the_thread->cpu_time_used );
|
||||
#else
|
||||
the_thread->cpu_time_used = 0;
|
||||
the_thread->cpu_time_used = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -49,7 +49,7 @@ void _Thread_Tickle_timeslice( void )
|
||||
|
||||
executing = _Thread_Executing;
|
||||
|
||||
#ifndef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
|
||||
/*
|
||||
* Increment the number of ticks this thread has been executing
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user