[PATCH] rtems: Remove rtems_rate_monotonic_postponed_job_count()

Kuan Hsun Chen c0066c at gmail.com
Wed Jan 25 16:56:03 UTC 2017


This is the patch for #2885 ticket.

2017-01-25 16:18 GMT+01:00 Kuan-Hsun Chen <c0066c at gmail.com>:

> Add a variable named "count" in rtems_rate_monotonic_period_status
> structure
> Revise rtems_rate_monotonic_get_status() for the postponed job count.
>
> sptests/sp69: Revise
> Add in the verification of the postponed job count for
> rtems_rate_monotonic_get_status().
> ---
>  cpukit/rtems/include/rtems/rtems/ratemon.h | 24 ++++--------------------
>  cpukit/rtems/src/ratemongetstatus.c        |  2 ++
>  cpukit/rtems/src/ratemonperiod.c           | 16 +---------------
>  testsuites/sptests/sp69/init.c             |  8 ++++++++
>  testsuites/sptests/sp69/sp69.doc           |  2 ++
>  testsuites/sptests/sp69/sp69.scn           |  5 +++--
>  6 files changed, 20 insertions(+), 37 deletions(-)
>
> diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h
> b/cpukit/rtems/include/rtems/rtems/ratemon.h
> index 54ddd05..5616ee9 100644
> --- a/cpukit/rtems/include/rtems/rtems/ratemon.h
> +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
> @@ -23,7 +23,7 @@
>
>  /* COPYRIGHT (c) 1989-2009, 2016.
>   * On-Line Applications Research Corporation (OAR).
> - * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> + * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
>   *
>   * The license and distribution terms for this file may be
>   * found in the file LICENSE in this distribution or at
> @@ -182,6 +182,9 @@ typedef struct {
>     *  then this field has no meaning.
>     */
>    rtems_thread_cpu_usage_t             executed_since_last_period;
> +
> +  /** This is the count of postponed jobs of this period. */
> +  uint32_t                             postponed_jobs_count;
>  }  rtems_rate_monotonic_period_status;
>
>  /**
> @@ -417,25 +420,6 @@ rtems_status_code rtems_rate_monotonic_period(
>    rtems_interval  length
>  );
>
> -/**
> - * @brief Return the number of postponed jobs
> - *
> - * This is a helper function for runtime monitoring to return
> - * the number of postponed jobs in this given period. This number
> - * is only increased by the corresponding watchdog,
> - * and is decreased by RMS manager with the postponed job releasing.
> - *
> - * @param[in] id is the period id
> - *
> - * @retval This helper function returns the number of postponed
> - * jobs with a given period_id.
> - *
> - */
> -uint32_t rtems_rate_monotonic_postponed_job_count(
> -  rtems_id        period_id
> -);
> -
> -
>  /**@}*/
>
>  #ifdef __cplusplus
> diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/
> ratemongetstatus.c
> index 403c6ed..4e6b964 100644
> --- a/cpukit/rtems/src/ratemongetstatus.c
> +++ b/cpukit/rtems/src/ratemongetstatus.c
> @@ -9,6 +9,7 @@
>   *  COPYRIGHT (c) 1989-2009.
>   *  On-Line Applications Research Corporation (OAR).
>   *  Copyright (c) 2016 embedded brains GmbH.
> + *  Copyright (c) 2017 Kuan-Hsun Chen.
>   *
>   *  The license and distribution terms for this file may be
>   *  found in the file LICENSE in this distribution or at
> @@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
>
>    period_status->owner = the_period->owner->Object.id;
>    period_status->state = the_period->state;
> +  period_status->postponed_jobs_count = the_period->postponed_jobs;
>
>    if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
>      /*
> diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/
> ratemonperiod.c
> index 97547e2..5b5d1dc 100644
> --- a/cpukit/rtems/src/ratemonperiod.c
> +++ b/cpukit/rtems/src/ratemonperiod.c
> @@ -9,7 +9,7 @@
>   *  COPYRIGHT (c) 1989-2010.
>   *  On-Line Applications Research Corporation (OAR).
>   *  Copyright (c) 2016 embedded brains GmbH.
> - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> + *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
>   *
>   *  The license and distribution terms for this file may be
>   *  found in the file LICENSE in this distribution or at
> @@ -302,20 +302,6 @@ static rtems_status_code _Rate_monotonic_Block_while_
> expired(
>    return RTEMS_TIMEOUT;
>  }
>
> -uint32_t rtems_rate_monotonic_postponed_job_count( rtems_id period_id )
> -{
> -  Rate_monotonic_Control *the_period;
> -  ISR_lock_Context        lock_context;
> -  uint32_t                jobs;
> -
> -  the_period = _Rate_monotonic_Get( period_id, &lock_context );
> -  _Assert( the_period != NULL );
> -
> -  jobs = the_period->postponed_jobs;
> -  _Rate_monotonic_Release( the_period, &lock_context );
> -  return jobs;
> -}
> -
>  rtems_status_code rtems_rate_monotonic_period(
>    rtems_id       id,
>    rtems_interval length
> diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/
> init.c
> index ac6f58c..c38beb8 100644
> --- a/testsuites/sptests/sp69/init.c
> +++ b/testsuites/sptests/sp69/init.c
> @@ -162,6 +162,14 @@ rtems_task Init(
>
>      rtems_test_assert( statistics.missed_count == i );
>    }
> +
> +  /* Check the status */
> +  status = rtems_rate_monotonic_get_status( period_id, &period_status );
> +  directive_failed( status, "rate_monotonic_get_status" );
> +  puts(
> +    "rtems_rate_monotonic_get_status - verify value of a postponed jobs
> count"
> +  );
> +  rtems_test_assert( period_status.postponed_jobs_count == 3 );
>
>    TEST_END();
>
> diff --git a/testsuites/sptests/sp69/sp69.doc b/testsuites/sptests/sp69/
> sp69.doc
> index fbf0e4e..60aacb8 100644
> --- a/testsuites/sptests/sp69/sp69.doc
> +++ b/testsuites/sptests/sp69/sp69.doc
> @@ -1,5 +1,6 @@
>  #  COPYRIGHT (c) 1989-2009.
>  #  On-Line Applications Research Corporation (OAR).
> +#  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
>  #
>  #  The license and distribution terms for this file may be
>  #  found in the file LICENSE in this distribution or at
> @@ -21,3 +22,4 @@ concepts:
>    a period is initiated.
>  + Verify the correctness of the status values returned on an active
> period.
>  + Ensure the missed period count is properly maintained.
> ++ Verify the correctness of the postponed job count.
> diff --git a/testsuites/sptests/sp69/sp69.scn b/testsuites/sptests/sp69/
> sp69.scn
> index 654eea0..e102d22 100644
> --- a/testsuites/sptests/sp69/sp69.scn
> +++ b/testsuites/sptests/sp69/sp69.scn
> @@ -2,8 +2,9 @@
>  rtems_rate_monotonic_get_status - verify values of an inactive period
>  rtems_rate_monotonic_get_status - check RTEMS_NOT_DEFINED
>  rtems_rate_monotonic_get_status - verify values of an active period
> -wall time should be ~600000000 is 609216000
> -cpu time should be ~100000000 is 109217000
> +wall time should be ~600000000 is 609402399
> +cpu time should be ~100000000 is 109612659
>  rtems_rate_monotonic_cancel -  OK
>  Testing statistics on missed periods
> +rtems_rate_monotonic_get_status - verify value of a postponed jobs count
>  *** END OF TEST 69 ***
> --
> 1.9.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170125/50e57d9b/attachment-0002.html>


More information about the devel mailing list