From e98aa0573f982ff794415a3a4081fdd2a70965d3 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 17 Nov 2010 07:27:23 +0000 Subject: [PATCH] affinity call --- Robust/src/Runtime/affinity.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Robust/src/Runtime/affinity.h diff --git a/Robust/src/Runtime/affinity.h b/Robust/src/Runtime/affinity.h new file mode 100644 index 00000000..1834d7b4 --- /dev/null +++ b/Robust/src/Runtime/affinity.h @@ -0,0 +1,16 @@ +#ifndef AFFINITY_H +#define AFFINITY_H + +static void set_affinity(unsigned long cpu) { + int err; + cpu_set_t cpumask; + + CPU_ZERO(&cpumask); + CPU_SET(cpu, &cpumask); + err = sched_setaffinity(syscall(SYS_gettid), + sizeof(cpu_set_t), &cpumask); + + if (err == -1) + printf("set_affinity: %s\n", strerror(errno)); +} +#endif -- 2.34.1