os_low_level_helper.h 480 Bytes
Newer Older
qon's avatar
qon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef OS_LOW_LEVEL_HELPER_H
#define OS_LOW_LEVEL_HELPER_H

#ifndef _WIN32
#include <syscall.h>
#include <unistd.h> 
#endif

inline int get_number_of_cpu_cores()
{
#ifdef _WIN32
	SYSTEM_INFO info;
	GetSystemInfo(&info);
	return(info.dwNumberOfProcessors);
#else
	return(sysconf(_SC_NPROCESSORS_ONLN));
#endif
}

inline int get_standard_page_size()
{
#ifdef _WIN32
	SYSTEM_INFO info;
	GetSystemInfo(&info);
	return(info.dwPageSize);
#else
	return(getpagesize());
#endif
}

#endif