win-pvdrivers

view liblfds.6/test/src/abstraction_cpu_count.c @ 1025:aa2e51f67f7c

Fix hibernate under Win8. Change debugprints.
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 19 15:14:53 2013 +1100 (2013-02-19)
parents 6300617040e0
children
line source
1 #include "internal.h"
7 /****************************************************************************/
8 #if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD)
10 /* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler
12 _WIN32 indicates 64-bit or 32-bit Windows
13 _MSC_VER indicates Microsoft C compiler
14 !WIN_KERNEL_BUILD indicates Windows user-mode
15 */
17 unsigned int abstraction_cpu_count()
18 {
19 SYSTEM_INFO
20 si;
22 GetNativeSystemInfo( &si );
24 return( (unsigned int) si.dwNumberOfProcessors );
25 }
27 #endif
33 /****************************************************************************/
34 #if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD)
36 /* TRD : any Windows on any CPU with the Microsoft C compiler
38 _WIN32 indicates 64-bit or 32-bit Windows
39 _MSC_VER indicates Microsoft C compiler
40 WIN_KERNEL_BUILD indicates Windows kernel
41 */
43 unsigned int abstraction_cpu_count()
44 {
45 unsigned int
46 active_processor_count;
48 active_processor_count = KeQueryActiveProcessorCount( NULL );
50 return( active_processor_count );
51 }
53 #endif
59 /****************************************************************************/
60 #if (defined __linux__ && __GNUC__)
62 /* TRD : Linux on any CPU with GCC
64 this function I believe is Linux specific and varies by UNIX flavour
66 __linux__ indicates Linux
67 __GNUC__ indicates GCC
68 */
70 unsigned int abstraction_cpu_count()
71 {
72 long int
73 cpu_count;
75 cpu_count = sysconf( _SC_NPROCESSORS_ONLN );
77 return( (unsigned int) cpu_count );
78 }
80 #endif