On 17 November 2016 at 17:34, Juri Lelli juri.lelli@arm.com wrote:
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
src/rt-app.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/rt-app.c b/src/rt-app.c index bce004bc91a3..dc84e2cc22ff 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);
-- 2.10.0