@@ -26,6 +26,8 @@ pub type idtype_t = ::c_uint;
2626pub type integer_t = :: c_int ;
2727pub type cpu_type_t = integer_t ;
2828pub type cpu_subtype_t = integer_t ;
29+ pub type natural_t = u32 ;
30+ pub type mach_msg_type_number_t = natural_t ;
2931
3032pub type posix_spawnattr_t = * mut :: c_void ;
3133pub type posix_spawn_file_actions_t = * mut :: c_void ;
@@ -39,6 +41,15 @@ pub type mach_port_t = ::c_uint;
3941
4042pub type iconv_t = * mut :: c_void ;
4143
44+ pub type processor_cpu_load_info_t = * mut processor_cpu_load_info ;
45+ pub type processor_cpu_load_info_data_t = processor_cpu_load_info ;
46+ pub type processor_basic_info_t = * mut processor_basic_info ;
47+ pub type processor_basic_info_data_t = processor_basic_info ;
48+ pub type processor_set_basic_info_data_t = processor_set_basic_info ;
49+ pub type processor_set_basic_info_t = * mut processor_set_basic_info ;
50+ pub type processor_set_load_info_data_t = processor_set_load_info ;
51+ pub type processor_set_load_info_t = * mut processor_set_load_info ;
52+
4253deprecated_mach ! {
4354 pub type vm_prot_t = :: c_int;
4455 pub type vm_size_t = :: uintptr_t;
@@ -662,6 +673,30 @@ s_no_extra_traits! {
662673 __unused1: * mut :: c_void, //actually a function pointer
663674 pub sigev_notify_attributes: * mut :: pthread_attr_t
664675 }
676+
677+ pub struct processor_cpu_load_info {
678+ pub cpu_ticks: [ :: c_uint; CPU_STATE_MAX as usize ] ,
679+ }
680+
681+ pub struct processor_basic_info {
682+ pub cpu_type: cpu_type_t,
683+ pub cpu_subtype: cpu_subtype_t,
684+ pub running: :: boolean_t,
685+ pub slot_num: :: c_int,
686+ pub is_master: :: boolean_t,
687+ }
688+
689+ pub struct processor_set_basic_info {
690+ pub processor_count: :: c_int,
691+ pub default_policy: :: c_int,
692+ }
693+
694+ pub struct processor_set_load_info {
695+ pub task_count: :: c_int,
696+ pub thread_count: :: c_int,
697+ pub load_average: integer_t,
698+ pub mach_factor: integer_t,
699+ }
665700}
666701
667702impl siginfo_t {
@@ -1276,6 +1311,106 @@ cfg_if! {
12761311 self . sigev_notify_attributes. hash( state) ;
12771312 }
12781313 }
1314+
1315+ impl PartialEq for processor_cpu_load_info {
1316+ fn eq( & self , other: & processor_cpu_load_info) -> bool {
1317+ self . cpu_ticks == other. cpu_ticks
1318+ }
1319+ }
1320+ impl Eq for processor_cpu_load_info { }
1321+ impl :: fmt:: Debug for processor_cpu_load_info {
1322+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1323+ f. debug_struct( "processor_cpu_load_info" )
1324+ . field( "cpu_ticks" , & self . cpu_ticks)
1325+ . finish( )
1326+ }
1327+ }
1328+ impl :: hash:: Hash for processor_cpu_load_info {
1329+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1330+ self . cpu_ticks. hash( state) ;
1331+ }
1332+ }
1333+
1334+ impl PartialEq for processor_basic_info {
1335+ fn eq( & self , other: & processor_basic_info) -> bool {
1336+ self . cpu_type == other. cpu_type
1337+ && self . cpu_subtype == other. cpu_subtype
1338+ && self . running == other. running
1339+ && self . slot_num == other. slot_num
1340+ && self . is_master == other. is_master
1341+ }
1342+ }
1343+ impl Eq for processor_basic_info { }
1344+ impl :: fmt:: Debug for processor_basic_info {
1345+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1346+ f. debug_struct( "processor_basic_info" )
1347+ . field( "cpu_type" , & self . cpu_type)
1348+ . field( "cpu_subtype" , & self . cpu_subtype)
1349+ . field( "running" , & self . running)
1350+ . field( "slot_num" , & self . slot_num)
1351+ . field( "is_master" , & self . is_master)
1352+ . finish( )
1353+ }
1354+ }
1355+ impl :: hash:: Hash for processor_basic_info {
1356+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1357+ self . cpu_type. hash( state) ;
1358+ self . cpu_subtype. hash( state) ;
1359+ self . running. hash( state) ;
1360+ self . slot_num. hash( state) ;
1361+ self . is_master. hash( state) ;
1362+ }
1363+ }
1364+
1365+ impl PartialEq for processor_set_basic_info {
1366+ fn eq( & self , other: & processor_set_basic_info) -> bool {
1367+ self . processor_count == other. processor_count
1368+ && self . default_policy == other. default_policy
1369+ }
1370+ }
1371+ impl Eq for processor_set_basic_info { }
1372+ impl :: fmt:: Debug for processor_set_basic_info {
1373+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1374+ f. debug_struct( "processor_set_basic_info" )
1375+ . field( "processor_count" , & self . processor_count)
1376+ . field( "default_policy" , & self . default_policy)
1377+ . finish( )
1378+ }
1379+ }
1380+ impl :: hash:: Hash for processor_set_basic_info {
1381+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1382+ self . processor_count. hash( state) ;
1383+ self . default_policy. hash( state) ;
1384+ }
1385+ }
1386+
1387+ impl PartialEq for processor_set_load_info {
1388+ fn eq( & self , other: & processor_set_load_info) -> bool {
1389+ self . task_count == other. task_count
1390+ && self . thread_count == other. thread_count
1391+ && self . load_average == other. load_average
1392+ && self . mach_factor == other. mach_factor
1393+ }
1394+ }
1395+ impl Eq for processor_set_load_info { }
1396+ impl :: fmt:: Debug for processor_set_load_info {
1397+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1398+ f. debug_struct( "processor_set_load_info" )
1399+ . field( "task_count" , & self . task_count)
1400+ . field( "thread_count" , & self . thread_count)
1401+ . field( "load_average" , & self . load_average)
1402+ . field( "mach_factor" , & self . mach_factor)
1403+ . finish( )
1404+ }
1405+ }
1406+ impl :: hash:: Hash for processor_set_load_info {
1407+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1408+ self . task_count. hash( state) ;
1409+ self . thread_count. hash( state) ;
1410+ self . load_average. hash( state) ;
1411+ self . mach_factor. hash( state) ;
1412+ }
1413+ }
12791414 }
12801415}
12811416
@@ -1501,6 +1636,13 @@ pub const CPU_STATE_IDLE: ::c_int = 2;
15011636pub const CPU_STATE_NICE : :: c_int = 3 ;
15021637pub const CPU_STATE_MAX : :: c_int = 4 ;
15031638
1639+ pub const PROCESSOR_BASIC_INFO : :: c_int = 1 ;
1640+ pub const PROCESSOR_CPU_LOAD_INFO : :: c_int = 2 ;
1641+ pub const PROCESSOR_PM_REGS_INFO : :: c_int = 0x10000001 ;
1642+ pub const PROCESSOR_TEMPERATURE : :: c_int = 0x10000002 ;
1643+ pub const PROCESSOR_SET_LOAD_INFO : :: c_int = 4 ;
1644+ pub const PROCESSOR_SET_BASIC_INFO : :: c_int = 5 ;
1645+
15041646deprecated_mach ! {
15051647 pub const VM_FLAGS_FIXED : :: c_int = 0x0000 ;
15061648 pub const VM_FLAGS_ANYWHERE : :: c_int = 0x0001 ;
0 commit comments