Hi,

The following patch fixes two problems in loop variables of gtod_latency 
test case

1) The loop variable 'k' could overflow on 32 bit systems, leading to a 
SEGV.
2) The inner loop was not of constant duration. This meant the frequency
of calls to usleep() depend on the number of total iterations. It is desirable
to make this frequency a constant.

Thanks,
Sripathi.

Changelog:
 * Fix loop variables in gtod_latency test case.

Signed-off-by: Sripathi Kodi <[EMAIL PROTECTED]>
Acked-by: Darren Hart <[EMAIL PROTECTED]>

diff -uprN ltp_cvs_4dec.org/testcases/realtime/func/gtod_latency/gtod_latency.c 
ltp_cvs_4dec/testcases/realtime/func/gtod_latency/gtod_latency.c
--- ltp_cvs_4dec.org/testcases/realtime/func/gtod_latency/gtod_latency.c        
2008-12-04 11:24:49.000000000 +0530
+++ ltp_cvs_4dec/testcases/realtime/func/gtod_latency/gtod_latency.c    
2008-12-04 11:25:06.000000000 +0530
@@ -263,9 +263,9 @@ int main(int argc, char *argv[])
        }
        /* This loop runs for a long time, hence can cause soft lockups.
           Calling sleep periodically avoids this. */
-       for (i=0; i<1000; i++) {
-               for (j=0; j < ITERATIONS/1000; j++) {
-                       k = (i * ITERATIONS/1000) + j;
+       for (i=0; i<(ITERATIONS/10000); i++) {
+               for (j=0; j < 10000; j++) {
+                       k = (i * 10000) + j;
                        clock_gettime(CLOCK_MONOTONIC,&start_data[k]);
                        clock_gettime(CLOCK_MONOTONIC,&stop_data[k]);
                }

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to