poll() uses msecs as timeout
[elliptics.git] / cmake / Modules / CheckProcStats.cmake
blob3d47abb10cb42d9a064f0b90f0ce6174f244f19d
1 # Check supported methods to gather system statistics
3 if(EXISTS "/proc/loadavg" AND EXISTS "/proc/meminfo")
4     set(HAVE_PROC_STAT 1)
5     add_definitions(-DHAVE_PROC_STAT=1)
6     message(STATUS "System supports procfs statistics")
7     return()
8 endif()
10 include(CheckCSourceRuns)
11 if (UNIX OR MINGW)
12     SET(CMAKE_REQUIRED_DEFINITIONS -Werror-implicit-function-declaration)
13 endif()
14 check_c_source_runs("#include <stdio.h>
15 #include <sys/types.h>
16 #include <sys/sysctl.h>
17 #include <sys/resource.h>
18 int main()
20     struct loadavg la;
21     size_t sz = sizeof(la);
22     return sysctlbyname(\"vm.loadavg\", &la, &sz, NULL, 0);
23 }" HAVE_SYSCTL_STAT)
24 unset(CMAKE_REQUIRED_DEFINITIONS)
25 if (HAVE_SYSCTL_STAT)
26     add_definitions(-DHAVE_SYSCTL_STAT=1)
27     message(STATUS "System supports sysctl statistics")
28 endif()