From: Subrata <sub...@us...> - 2008-07-25 00:11:00
|
Update of /cvsroot/ltp/ltp/testcases/realtime/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21791/ltp/testcases/realtime/lib Modified Files: librttest.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: librttest.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/lib/librttest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** librttest.c 3 Jun 2008 13:14:28 -0000 1.7 --- librttest.c 25 Jul 2008 00:10:56 -0000 1.8 *************** *** 399,402 **** --- 399,415 ---- } + /* 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; + } + void rt_nanosleep_until(nsec_t ns) { struct timespec ts_sleep, ts_rem; |