summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2009-12-14 16:13:09 +0100
committerJohn Kacur <jkacur@redhat.com>2009-12-14 16:13:09 +0100
commita017e969b3e07c726ea472b9294d899d11822d67 (patch)
tree45401a1a4ccc8e90e4760f7c1f0965316e565122
parent92b0181ce8006c52cc19139dabfa155cca69e9f1 (diff)
downloadrt-tests-a017e969b3e07c726ea472b9294d899d11822d67.tar.gz
Use sched_getcpu
- sched_getcpu is available since glibc 2.6 - the current tests were broken in anycase. Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--src/ptsematest/ptsematest.c18
-rw-r--r--src/sigwaittest/sigwaittest.c18
2 files changed, 2 insertions, 34 deletions
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index e040417..c4426f3 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -33,17 +33,13 @@
#include <sys/time.h>
#include <sys/mman.h>
#include <linux/unistd.h>
+#include <utmpx.h>
#include "rt-utils.h"
#define __USE_GNU
#include <pthread.h>
-#undef HAS_SCHED_GETCPU
-
#define gettid() syscall(__NR_gettid)
-#ifndef HAS_SCHED_GETCPU
-#define getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
-#endif
#define USEC_PER_SEC 1000000
@@ -112,13 +108,7 @@ void *semathread(void *param)
if(par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
par->cpu = sched_getcpu();
-#else
- int c, s;
- s = getcpu(&c, NULL, NULL);
- par->cpu = (s == -1) ? s : c;
-#endif
}
} else {
/* Receiver */
@@ -160,13 +150,7 @@ void *semathread(void *param)
if (par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
par->cpu = sched_getcpu();
-#else
- int c, s;
- s = getcpu(&c, NULL, NULL);
- par->cpu = (s == -1) ? s : c;
-#endif
}
nanosleep(&par->delay, NULL);
pthread_mutex_unlock(&syncmutex[par->num]);
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index a3bbebc..740e13d 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -35,17 +35,13 @@
#include <sys/types.h>
#include <sys/time.h>
#include <linux/unistd.h>
+#include <utmpx.h>
#include "rt-utils.h"
#define __USE_GNU
#include <pthread.h>
-#undef HAS_SCHED_GETCPU
-
#define gettid() syscall(__NR_gettid)
-#ifndef HAS_SCHED_GETCPU
-#define getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
-#endif
#define USEC_PER_SEC 1000000
@@ -143,13 +139,7 @@ void *semathread(void *param)
par->shutdown = 1;
if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
par->cpu = sched_getcpu();
-#else
- int c, s;
- s = getcpu(&c, NULL, NULL);
- par->cpu = (s == -1) ? s : c;
-#endif
}
sigwait(&sigset, &sig);
} else {
@@ -173,13 +163,7 @@ void *semathread(void *param)
par->shutdown = 1;
if (mustgetcpu) {
-#ifdef HAS_SCHED_GETCPU
par->cpu = sched_getcpu();
-#else
- int c, s;
- s = getcpu(&c, NULL, NULL);
- par->cpu = (s == -1) ? s : c;
-#endif
}
/*
* Latency is the time spent between sending and