summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraappleby@google.com <aappleby@google.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2011-04-04 23:38:12 +0000
committeraappleby@google.com <aappleby@google.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2011-04-04 23:38:12 +0000
commit4bbda98dc256abd514bb2011560cded111fd205b (patch)
treee74973e0d9764b01a243e1d4e7034c1ff7c69dd8
parent9715053bffb6aa255104427c756084e815e530aa (diff)
downloadsrc-4bbda98dc256abd514bb2011560cded111fd205b.tar.gz
Add CPU affinity to gcc build
git-svn-id: http://smhasher.googlecode.com/svn/trunk@123 77a7d1d3-4c08-bdc2-d393-d5859734b01a
-rw-r--r--Platform.cpp12
1 files changed, 12 insertions, 0 deletions
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 <sched.h>
+
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