blob: 3c97694b7c5903aa4a4eb32a18141d684270f7e7 [file] [log] [blame]
tanjent@gmail.comf3b78972012-03-01 03:38:55 +00001#include "Platform.h"
2
3#include <stdio.h>
4
5void testRDTSC ( void )
6{
7 int64_t temp = rdtsc();
8
9 printf("%d",(int)temp);
10}
11
12#if defined(_MSC_VER)
13
14#include <windows.h>
15
16void SetAffinity ( int cpu )
17{
18 SetProcessAffinityMask(GetCurrentProcess(),cpu);
19 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
20}
21
22#else
23
24#include <sched.h>
25
26void SetAffinity ( int /*cpu*/ )
27{
tanjent@gmail.com6895dce2012-05-11 04:59:07 +000028#if !defined(__CYGWIN__) && !defined(__APPLE__)
tanjent@gmail.comf3b78972012-03-01 03:38:55 +000029 cpu_set_t mask;
30
31 CPU_ZERO(&mask);
32
33 CPU_SET(2,&mask);
34
35 if( sched_setaffinity(0,sizeof(mask),&mask) == -1)
36 {
37 printf("WARNING: Could not set CPU affinity\n");
38 }
39#endif
40}
41
42#endif