Add a Missed period (calc took too long) check to periodic_cpu_load
just as is done in periodic_cpu_load_single.
Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
Acked-by: Darren Hart <[EMAIL PROTECTED]>
Cc: Tim Chavez <[EMAIL PROTECTED]>
---
.../func/periodic_cpu_load/periodic_cpu_load.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
index ba65699..935a058 100644
--- a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
+++ b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
@@ -127,7 +127,7 @@ void *periodic_thread(void *thread)
void*(*func)(void*) = parg->func;
int i = 0;
- nsec_t next;
+ nsec_t next, now;
nsec_t exe_start, exe_end, exe_time;
next = rt_gettime();
@@ -146,7 +146,14 @@ void *periodic_thread(void *thread)
dat[t->id].records[i].y = exe_time/NS_PER_US;
i++;
- rt_nanosleep(next - rt_gettime());
+
+ now = rt_gettime();
+ if (now > next) {
+ printf("Missed period, aborting (calc took too
long)\n");
+ fail[t->id] = 1;
+ break;
+ }
+ rt_nanosleep(next - now);
}
printf("TID %d (%c - prio %d) complete\n", t->id, groupname[t->id>>2],
--
1.5.4.rc2.84.gf85fd-dirty
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list