diff options
author | Juri Lelli <juri.lelli@arm.com> | 2015-05-21 12:33:57 +0100 |
---|---|---|
committer | Juri Lelli <juri.lelli@arm.com> | 2016-11-25 08:21:17 +0000 |
commit | 6026f2deadaa913b91d78a30fe41aa7ae20bd222 (patch) | |
tree | 65eef39088582617df12c76d5f6148fb945ee62c | |
parent | 1310be6538232dc0ae2dfc237b7a793983710687 (diff) |
rt-app: fix batch tasks
A big run duration can cause load_count to overflow.
Fix this issue by running the workload in bursts of 1 sec each.
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
-rw-r--r-- | src/rt-app.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/rt-app.c b/src/rt-app.c index 5a550eb..76a1f68 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -48,10 +48,11 @@ static ftrace_data_t ft_data = { * Function: to do some useless operation. * TODO: improve the waste loop with more heavy functions */ -void waste_cpu_cycles(int load_loops) +void waste_cpu_cycles(unsigned long long load_loops) { double param, result; - double n, i; + double n; + unsigned long long i; param = 0.95; n = 4; @@ -175,7 +176,24 @@ int calibrate_cpu_cycles(int clock) static inline unsigned long loadwait(unsigned long exec) { unsigned long load_count; + unsigned long secs; + int i; + + /* + * If exec is still too big, let's run it in bursts + * so that we don't overflow load_count. + */ + secs = exec / 1000000; + for (i = 0; i < secs; i++) { + load_count = 1000000000/p_load; + waste_cpu_cycles(load_count); + exec -= 1000000; + } + + /* + * Run for the remainig exec (if any). + */ load_count = (exec * 1000)/p_load; waste_cpu_cycles(load_count); |