<div dir="ltr"><span class="gmail-im">This is the patch for #2885 ticket.<br></span></div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-25 16:18 GMT+01:00 Kuan-Hsun Chen <span dir="ltr"><<a href="mailto:c0066c@gmail.com" target="_blank">c0066c@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Add a variable named "count" in rtems_rate_monotonic_period_<wbr>status structure<br>
Revise rtems_rate_monotonic_get_<wbr>status() for the postponed job count.<br>
<br>
sptests/sp69: Revise<br>
Add in the verification of the postponed job count for rtems_rate_monotonic_get_<wbr>status().<br>
---<br>
cpukit/rtems/include/rtems/<wbr>rtems/ratemon.h | 24 ++++--------------------<br>
cpukit/rtems/src/<wbr>ratemongetstatus.c | 2 ++<br>
cpukit/rtems/src/<wbr>ratemonperiod.c | 16 +---------------<br>
testsuites/sptests/sp69/init.c | 8 ++++++++<br>
testsuites/sptests/sp69/sp69.<wbr>doc | 2 ++<br>
testsuites/sptests/sp69/sp69.<wbr>scn | 5 +++--<br>
6 files changed, 20 insertions(+), 37 deletions(-)<br>
<br>
diff --git a/cpukit/rtems/include/rtems/<wbr>rtems/ratemon.h b/cpukit/rtems/include/rtems/<wbr>rtems/ratemon.h<br>
index 54ddd05..5616ee9 100644<br>
--- a/cpukit/rtems/include/rtems/<wbr>rtems/ratemon.h<br>
+++ b/cpukit/rtems/include/rtems/<wbr>rtems/ratemon.h<br>
@@ -23,7 +23,7 @@<br>
<br>
/* COPYRIGHT (c) 1989-2009, 2016.<br>
* On-Line Applications Research Corporation (OAR).<br>
- * COPYRIGHT (c) 2016 Kuan-Hsun Chen.<br>
+ * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.<br>
*<br>
* The license and distribution terms for this file may be<br>
* found in the file LICENSE in this distribution or at<br>
@@ -182,6 +182,9 @@ typedef struct {<br>
* then this field has no meaning.<br>
*/<br>
rtems_thread_cpu_usage_t executed_since_last_period;<br>
+<br>
+ /** This is the count of postponed jobs of this period. */<br>
+ uint32_t postponed_jobs_count;<br>
} rtems_rate_monotonic_period_<wbr>status;<br>
<br>
/**<br>
@@ -417,25 +420,6 @@ rtems_status_code rtems_rate_monotonic_period(<br>
rtems_interval length<br>
);<br>
<br>
-/**<br>
- * @brief Return the number of postponed jobs<br>
- *<br>
- * This is a helper function for runtime monitoring to return<br>
- * the number of postponed jobs in this given period. This number<br>
- * is only increased by the corresponding watchdog,<br>
- * and is decreased by RMS manager with the postponed job releasing.<br>
- *<br>
- * @param[in] id is the period id<br>
- *<br>
- * @retval This helper function returns the number of postponed<br>
- * jobs with a given period_id.<br>
- *<br>
- */<br>
-uint32_t rtems_rate_monotonic_<wbr>postponed_job_count(<br>
- rtems_id period_id<br>
-);<br>
-<br>
-<br>
/**@}*/<br>
<br>
#ifdef __cplusplus<br>
diff --git a/cpukit/rtems/src/<wbr>ratemongetstatus.c b/cpukit/rtems/src/<wbr>ratemongetstatus.c<br>
index 403c6ed..4e6b964 100644<br>
--- a/cpukit/rtems/src/<wbr>ratemongetstatus.c<br>
+++ b/cpukit/rtems/src/<wbr>ratemongetstatus.c<br>
@@ -9,6 +9,7 @@<br>
* COPYRIGHT (c) 1989-2009.<br>
* On-Line Applications Research Corporation (OAR).<br>
* Copyright (c) 2016 embedded brains GmbH.<br>
+ * Copyright (c) 2017 Kuan-Hsun Chen.<br>
*<br>
* The license and distribution terms for this file may be<br>
* found in the file LICENSE in this distribution or at<br>
@@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_<wbr>status(<br>
<br>
period_status->owner = the_period->owner->Object.id;<br>
period_status->state = the_period->state;<br>
+ period_status->postponed_jobs_<wbr>count = the_period->postponed_jobs;<br>
<br>
if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {<br>
/*<br>
diff --git a/cpukit/rtems/src/<wbr>ratemonperiod.c b/cpukit/rtems/src/<wbr>ratemonperiod.c<br>
index 97547e2..5b5d1dc 100644<br>
--- a/cpukit/rtems/src/<wbr>ratemonperiod.c<br>
+++ b/cpukit/rtems/src/<wbr>ratemonperiod.c<br>
@@ -9,7 +9,7 @@<br>
* COPYRIGHT (c) 1989-2010.<br>
* On-Line Applications Research Corporation (OAR).<br>
* Copyright (c) 2016 embedded brains GmbH.<br>
- * COPYRIGHT (c) 2016 Kuan-Hsun Chen.<br>
+ * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.<br>
*<br>
* The license and distribution terms for this file may be<br>
* found in the file LICENSE in this distribution or at<br>
@@ -302,20 +302,6 @@ static rtems_status_code _Rate_monotonic_Block_while_<wbr>expired(<br>
return RTEMS_TIMEOUT;<br>
}<br>
<br>
-uint32_t rtems_rate_monotonic_<wbr>postponed_job_count( rtems_id period_id )<br>
-{<br>
- Rate_monotonic_Control *the_period;<br>
- ISR_lock_Context lock_context;<br>
- uint32_t jobs;<br>
-<br>
- the_period = _Rate_monotonic_Get( period_id, &lock_context );<br>
- _Assert( the_period != NULL );<br>
-<br>
- jobs = the_period->postponed_jobs;<br>
- _Rate_monotonic_Release( the_period, &lock_context );<br>
- return jobs;<br>
-}<br>
-<br>
rtems_status_code rtems_rate_monotonic_period(<br>
rtems_id id,<br>
rtems_interval length<br>
diff --git a/testsuites/sptests/sp69/<wbr>init.c b/testsuites/sptests/sp69/<wbr>init.c<br>
index ac6f58c..c38beb8 100644<br>
--- a/testsuites/sptests/sp69/<wbr>init.c<br>
+++ b/testsuites/sptests/sp69/<wbr>init.c<br>
@@ -162,6 +162,14 @@ rtems_task Init(<br>
<br>
rtems_test_assert( statistics.missed_count == i );<br>
}<br>
+<br>
+ /* Check the status */<br>
+ status = rtems_rate_monotonic_get_<wbr>status( period_id, &period_status );<br>
+ directive_failed( status, "rate_monotonic_get_status" );<br>
+ puts(<br>
+ "rtems_rate_monotonic_get_<wbr>status - verify value of a postponed jobs count"<br>
+ );<br>
+ rtems_test_assert( period_status.postponed_jobs_<wbr>count == 3 );<br>
<br>
TEST_END();<br>
<br>
diff --git a/testsuites/sptests/sp69/<wbr>sp69.doc b/testsuites/sptests/sp69/<wbr>sp69.doc<br>
index fbf0e4e..60aacb8 100644<br>
--- a/testsuites/sptests/sp69/<wbr>sp69.doc<br>
+++ b/testsuites/sptests/sp69/<wbr>sp69.doc<br>
@@ -1,5 +1,6 @@<br>
# COPYRIGHT (c) 1989-2009.<br>
# On-Line Applications Research Corporation (OAR).<br>
+# COPYRIGHT (c) 2017 Kuan-Hsun Chen.<br>
#<br>
# The license and distribution terms for this file may be<br>
# found in the file LICENSE in this distribution or at<br>
@@ -21,3 +22,4 @@ concepts:<br>
a period is initiated.<br>
+ Verify the correctness of the status values returned on an active period.<br>
+ Ensure the missed period count is properly maintained.<br>
++ Verify the correctness of the postponed job count.<br>
diff --git a/testsuites/sptests/sp69/<wbr>sp69.scn b/testsuites/sptests/sp69/<wbr>sp69.scn<br>
index 654eea0..e102d22 100644<br>
--- a/testsuites/sptests/sp69/<wbr>sp69.scn<br>
+++ b/testsuites/sptests/sp69/<wbr>sp69.scn<br>
@@ -2,8 +2,9 @@<br>
rtems_rate_monotonic_get_<wbr>status - verify values of an inactive period<br>
rtems_rate_monotonic_get_<wbr>status - check RTEMS_NOT_DEFINED<br>
rtems_rate_monotonic_get_<wbr>status - verify values of an active period<br>
-wall time should be ~600000000 is 609216000<br>
-cpu time should be ~100000000 is 109217000<br>
+wall time should be ~600000000 is 609402399<br>
+cpu time should be ~100000000 is 109612659<br>
rtems_rate_monotonic_cancel - OK<br>
Testing statistics on missed periods<br>
+rtems_rate_monotonic_get_<wbr>status - verify value of a postponed jobs count<br>
*** END OF TEST 69 ***<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br></div>