File: win32_system_info.xs

package info (click to toggle)
libsys-cpuaffinity-perl 1.13~03-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 252 kB
  • sloc: perl: 1,261; makefile: 3
file content (57 lines) | stat: -rw-r--r-- 1,339 bytes parent folder | download | duplicates (2)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>

#include <stdio.h>
#include <w32api/windows.h>
#include <w32api/winbase.h>

=pod
   
  Calls the MSWin32 GetSystemInfo system function, which can
  access the number of processors on the system, among
  other things.

=cut

MODULE = Sys::CpuAffinity   PACKAGE = Sys::CpuAffinity

#pragma comment(lib, "user32.lib")

void 
xs_display_system_info()
CODE:
   SYSTEM_INFO siSysInfo;
 
   // Copy the hardware information to the SYSTEM_INFO structure. 
 
   GetSystemInfo(&siSysInfo); 
 
   // Display the contents of the SYSTEM_INFO structure. 

   printf("Hardware information: \n");  
   printf("  OEM ID: %u\n", siSysInfo.dwOemId);
   printf("  Number of processors: %u\n", 
      siSysInfo.dwNumberOfProcessors); 
   printf("  Page size: %u\n", siSysInfo.dwPageSize); 
   printf("  Processor type: %u\n", siSysInfo.dwProcessorType); 
   printf("  Minimum application address: %lx\n", 
      siSysInfo.lpMinimumApplicationAddress); 
   printf("  Maximum application address: %lx\n", 
      siSysInfo.lpMaximumApplicationAddress); 
   printf("  Active processor mask: %u\n", 
      siSysInfo.dwActiveProcessorMask);



int
xs_get_numcpus_from_windows_system_info()
CODE:
	SYSTEM_INFO siSysInfo;
	GetSystemInfo(&siSysInfo);
	RETVAL = siSysInfo.dwNumberOfProcessors;
OUTPUT:
	RETVAL