From: Subrata <sub...@us...> - 2008-07-25 00:11:00
|
Update of /cvsroot/ltp/ltp/testcases/realtime/func/measurement In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21791/ltp/testcases/realtime/func/measurement Modified Files: preempt_timing.c rdtsc-latency.c Log Message: First patch regroups TSC functions and macros definition into librttest. Second patch is to have an atomic reading of the 64-bit timebase register of powerpc64. This new function is only valid if -m64 is used when compiling the whole testcase suite with a powerpc64. Thirs patch is a fix to avoid spurious tsc_minus warning. These patches been tested on a ppc64 machine either with 32 or 64 bit binaries. (-m64). The same TSC read (rdtscll) macros and tsc_minus where implemented in three different tests. This patch put all this into librttest.*. Signed-off-by: Gilles Carry <gil...@bu...>. Cc: Tim Chavez <ti...@us...>. Acked-by: Darren Hart <dv...@us...>. Index: rdtsc-latency.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/func/measurement/rdtsc-latency.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rdtsc-latency.c 20 Apr 2008 17:20:17 -0000 1.3 --- rdtsc-latency.c 25 Jul 2008 00:10:56 -0000 1.4 *************** *** 47,72 **** #define ITERATIONS 1000000 - #define ULL_MAX 18446744073709551615ULL // (1 << 64) - 1 - - #if defined(__i386__) - #define rdtscll(val) __asm__ __volatile__("rdtsc" : "=A" (val)) - #elif defined(__x86_64__) - #define rdtscll(val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t)high << 32 | low; \ - } while(0) - #elif defined(__powerpc__) /* 32 bit version */ - #define rdtscll(val) \ - do { \ - uint32_t tbhi, tblo ; \ - __asm__ __volatile__ ("mftbu %0" : "=r" (tbhi)); \ - __asm__ __volatile__ ("mftbl %0" : "=r" (tblo)); \ - val = 1000 * ((uint64_t) tbhi <<32) | tblo; \ - } while(0) - #else - #error - #endif void usage(void) --- 47,50 ---- *************** *** 101,116 **** } - /* return difference in microseconds */ - unsigned long long tsc_minus(unsigned long long tsc_start, unsigned long long tsc_end) - { - unsigned long long delta; - if (tsc_start < tsc_end) - delta = tsc_end - tsc_start; - else { - delta = ULL_MAX - (tsc_end - tsc_start) + 1; - printf("TSC wrapped, delta=%llu\n", delta); - } - return delta; - } /* calculate the tsc period */ --- 79,82 ---- Index: preempt_timing.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/func/measurement/preempt_timing.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** preempt_timing.c 20 Apr 2008 17:20:17 -0000 1.3 --- preempt_timing.c 25 Jul 2008 00:10:56 -0000 1.4 *************** *** 56,79 **** #include <libjvmsim.h> - #if defined(__i386__) - #define rdtscll(val) __asm__ __volatile__("rdtsc" : "=A" (val)) - #elif defined(__x86_64__) - #define rdtscll(val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t)high << 32 | low; \ - } while(0) - #elif defined(__powerpc__) /* 32bit version */ - #define rdtscll(val) \ - do { \ - uint32_t tbhi, tblo ; \ - __asm__ __volatile__ ("mftbu %0" : "=r" (tbhi)); \ - __asm__ __volatile__ ("mftbl %0" : "=r" (tblo)); \ - val = 1000 * ((uint64_t) tbhi <<32) | tblo; \ - } while(0) - #else - #error - #endif #define ITERATIONS 1000000ULL --- 56,59 ---- |