From 9f53c396009600012920bed212d8c5ae205a499b Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Tue, 29 Mar 2011 23:58:08 -0400 Subject: [PATCH] regressions/common: Add Mac OS X implementation off aff_iterate. --- regressions/common.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/regressions/common.h b/regressions/common.h index 399b706..c8ae4cd 100644 --- a/regressions/common.h +++ b/regressions/common.h @@ -32,6 +32,9 @@ #include #include #include +#elif defined(__MACH__) +#include +#include #endif #ifndef CORES @@ -66,6 +69,20 @@ aff_iterate(struct affinity *acb) return sched_setaffinity(gettid(), sizeof(s), &s); } +#elif defined(__MACH__) +CK_CC_UNUSED static int +aff_iterate(struct affinity *acb) +{ + thread_affinity_policy_data_t policy; + unsigned int c; + + c = ck_pr_faa_uint(&acb->request, acb->delta) % CORES; + policy.affinity_tag = c; + return thread_policy_set(mach_thread_self(), + THREAD_AFFINITY_POLICY, + (thread_policy_t)&policy, + THREAD_AFFINITY_POLICY_COUNT); +} #else CK_CC_UNUSED static int aff_iterate(struct affinity *acb CK_CC_UNUSED)