Author: gnichols Date: 2011-04-18 13:31:44 +0000 (Mon, 18 Apr 2011) New Revision: 881
Modified: trunk/tests/core/clocktest.c Log: 693429 - v7: clocktest only works up to 1024p
Modified: trunk/tests/core/clocktest.c =================================================================== --- trunk/tests/core/clocktest.c 2011-04-18 13:29:53 UTC (rev 880) +++ trunk/tests/core/clocktest.c 2011-04-18 13:31:44 UTC (rev 881) @@ -16,13 +16,29 @@ #define NSEC(ts) (ts.tv_sec*NSEC_PER_SEC + ts.tv_nsec)
#ifdef OLD_SCHED_SETAFFINITY -#define setaffinity(mask) sched_setaffinity(0,&mask) +#define setaffinity(mask) sched_setaffinity(0,mask) #else -#define setaffinity(mask) sched_setaffinity(0,sizeof(mask),&mask) +#ifdef CPU_ALLOC +#define setaffinity(mask) sched_setaffinity(0,CPU_ALLOC_SIZE(num_cpus),mask) +#else +#define setaffinity(mask) sched_setaffinity(0,sizeof(cpu_set_t),mask) #endif +#endif
+ +#ifdef CPU_ALLOC +cpu_set_t* cpu_alloc(unsigned num_cpus){ + printf("using CPU_CALLOC\n"); + return CPU_ALLOC(num_cpus); +} +#else +cpu_set_t* cpu_alloc(unsigned num_cpus){ + return malloc(sizeof(cpu_set_t)); +} +#endif + int test_clock_jitter(){ - cpu_set_t cpumask; + cpu_set_t* cpumask; struct timespec *time; unsigned long nsec; unsigned slow_cpu, fast_cpu; @@ -44,10 +60,11 @@ printf ("Testing for clock jitter on %u cpus\n", num_cpus);
time=malloc(num_cpus * sizeof(struct timespec)); + cpumask = cpu_alloc(num_cpus);
for (iter=0; iter<ITERATIONS; iter++){ for (cpu=0; cpu < num_cpus; cpu++) { - CPU_ZERO(&cpumask); CPU_SET(cpu,&cpumask); + CPU_ZERO(cpumask); CPU_SET(cpu,cpumask); if (setaffinity(cpumask) < 0){ perror ("sched_setaffinity"); return 1; }
v7-commits@lists.stg.fedorahosted.org