Author: gnichols
Date: 2012-08-28 13:17:21 +0000 (Tue, 28 Aug 2012)
New Revision: 1371
Modified:
trunk/tests/core/Makefile
trunk/tests/core/clocktest.c
Log:
822246 - clocktest use of CPUSET_S not completely correct.
Modified: trunk/tests/core/Makefile
===================================================================
--- trunk/tests/core/Makefile 2012-08-28 12:44:45 UTC (rev 1370)
+++ trunk/tests/core/Makefile 2012-08-28 13:17:21 UTC (rev 1371)
@@ -29,6 +29,7 @@
CFLAGS+=-Wall
+CFLAGS+=-DCPU_ALLOC
# sched_setaffinity has no size_t argument on older systems.
ifeq ($(shell grep 'sched_setaffinity.*size_t' /usr/include/sched.h),)
CFLAGS+=-DOLD_SCHED_SETAFFINITY
Modified: trunk/tests/core/clocktest.c
===================================================================
--- trunk/tests/core/clocktest.c 2012-08-28 12:44:45 UTC (rev 1370)
+++ trunk/tests/core/clocktest.c 2012-08-28 13:17:21 UTC (rev 1371)
@@ -31,10 +31,14 @@
printf("using CPU_CALLOC\n");
return CPU_ALLOC(num_cpus);
}
+#define cpu_zero(cpumask) CPU_ZERO_S(num_cpus, cpumask)
+#define cpu_set(cpu,cpumask) CPU_SET_S(cpu, num_cpus, cpumask)
#else
cpu_set_t* cpu_alloc(unsigned num_cpus){
return malloc(sizeof(cpu_set_t));
}
+#define cpu_zero(cpumask) CPU_ZERO(cpumask)
+#define cpu_set(cpu,cpumask) CPU_SET(cpu,cpumask)
#endif
int test_clock_jitter(){
@@ -64,8 +68,8 @@
for (iter=0; iter<ITERATIONS; iter++){
for (cpu=0; cpu < num_cpus; cpu++) {
- CPU_ZERO(cpumask); CPU_SET(cpu,cpumask);
- if (setaffinity(cpumask) < 0){
+ cpu_zero(cpumask); cpu_set(cpu,cpumask);
+ if (setaffinity(cpumask) < 0){
perror ("sched_setaffinity"); return 1;
}
/*
Show replies by date