From 4bbda98dc256abd514bb2011560cded111fd205b Mon Sep 17 00:00:00 2001 From: "aappleby@google.com" Date: Mon, 4 Apr 2011 23:38:12 +0000 Subject: Add CPU affinity to gcc build git-svn-id: http://smhasher.googlecode.com/svn/trunk@123 77a7d1d3-4c08-bdc2-d393-d5859734b01a --- Platform.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Platform.cpp') diff --git a/Platform.cpp b/Platform.cpp index dff36cb..bed3aa1 100644 --- a/Platform.cpp +++ b/Platform.cpp @@ -21,8 +21,20 @@ void SetAffinity ( int cpu ) #else +#include + void SetAffinity ( int /*cpu*/ ) { + cpu_set_t mask; + + CPU_ZERO(&mask); + + CPU_SET(2,&mask); + + if( sched_setaffinity(0,sizeof(mask),&mask) == -1) + { + printf("WARNING: Could not set CPU affinity\n"); + } } #endif -- cgit v1.2.3