[Xenomai-git] Philippe Gerum : testsuite/latency: set default affinity to CPU0

2015-04-16 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: f4882226c07f72284a14ac45427a6d47f7cfc433
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f4882226c07f72284a14ac45427a6d47f7cfc433

Author: Philippe Gerum 
Date:   Wed Mar 25 12:01:17 2015 +0100

testsuite/latency: set default affinity to CPU0

---

 testsuite/latency/latency.c |   18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index 2b51b06..e3dadae 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -576,7 +576,7 @@ static void sigdebug(int sig, siginfo_t *si, void *context)
 int main(int argc, char *const *argv)
 {
struct sigaction sa __attribute__((unused));
-   int c, err, sig, cpu = -1;
+   int c, err, sig, cpu = 0;
cpu_set_t cpus;
sigset_t mask;
 
@@ -792,17 +792,13 @@ int main(int argc, char *const *argv)
return 0;
}
 
-   if (cpu >= 0) {
-   CPU_ZERO(&cpus);
-   CPU_SET(cpu, &cpus);
-   err = pthread_attr_setaffinity_np(&tattr, sizeof(cpus),
-   &cpus);
-   if (err) {
-   fprintf(stderr,
-   "latency: failed to set CPU affinity, 
code %d\n",
-   err);
+   CPU_ZERO(&cpus);
+   CPU_SET(cpu, &cpus);
+   err = pthread_attr_setaffinity_np(&tattr, sizeof(cpus), &cpus);
+   if (err) {
+   fprintf(stderr,
+   "latency: failed to set CPU affinity, code 
%d\n", err);
return 0;
-   }
}
 
err = pthread_create(&latency_task, &tattr, &latency, NULL);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/latency: set default affinity to CPU0

2015-03-25 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f4882226c07f72284a14ac45427a6d47f7cfc433
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f4882226c07f72284a14ac45427a6d47f7cfc433

Author: Philippe Gerum 
Date:   Wed Mar 25 12:01:17 2015 +0100

testsuite/latency: set default affinity to CPU0

---

 testsuite/latency/latency.c |   18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index 2b51b06..e3dadae 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -576,7 +576,7 @@ static void sigdebug(int sig, siginfo_t *si, void *context)
 int main(int argc, char *const *argv)
 {
struct sigaction sa __attribute__((unused));
-   int c, err, sig, cpu = -1;
+   int c, err, sig, cpu = 0;
cpu_set_t cpus;
sigset_t mask;
 
@@ -792,17 +792,13 @@ int main(int argc, char *const *argv)
return 0;
}
 
-   if (cpu >= 0) {
-   CPU_ZERO(&cpus);
-   CPU_SET(cpu, &cpus);
-   err = pthread_attr_setaffinity_np(&tattr, sizeof(cpus),
-   &cpus);
-   if (err) {
-   fprintf(stderr,
-   "latency: failed to set CPU affinity, 
code %d\n",
-   err);
+   CPU_ZERO(&cpus);
+   CPU_SET(cpu, &cpus);
+   err = pthread_attr_setaffinity_np(&tattr, sizeof(cpus), &cpus);
+   if (err) {
+   fprintf(stderr,
+   "latency: failed to set CPU affinity, code 
%d\n", err);
return 0;
-   }
}
 
err = pthread_create(&latency_task, &tattr, &latency, NULL);


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git