#include <mach/thread_info.h> also included by
<mach/mach.h>mach/thread_info.h
typedefthread_flavor_t
Generic information structure to allow for expansion.
typedef natural_t thread_flavor_t
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Defined values:
| THREAD_BASIC_INFO | Returns basic information about the thread, such as the thread's run state and suspend count. The returned structure is thread_basic_info. |
| THREAD_SCHED_FIFO_INFO | Returns FIFO scheduling policy information about the thread. The returned structure is policy_fifo_info. |
| THREAD_SCHED_RR_INFO | Returns round-robin scheduling policy information about the thread. The returned structure is policy_rr_info. |
| THREAD_SCHED_TIMESHARE_INFO | Returns timeshare scheduling policy information about the thread. The returned structure is policy_timeshare_info. |
typedefthread_info_data_t
typedef integer_t thread_info_data_t[THREAD_INFO_MAX]
macroTHREAD_BASIC_INFO
Currently defined information.
#define THREAD_BASIC_INFO 3
basic information
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Returns basic information about the thread, such as the thread's run state and suspend count. The returned structure is thread_basic_info.
structthread_basic_info
| time_value_t | user_time | user run time |
| time_value_t | system_time | system run time |
| integer_t | cpu_usage | scaled cpu usage percentage |
| policy_t | policy | scheduling policy in effect |
| integer_t | run_state | run state (see below) |
| integer_t | flags | various flags (see below) |
| integer_t | suspend_count | suspend count for thread |
| integer_t | sleep_time | number of seconds that thread has been sleeping |
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Defines basic information for a thread.
The thread_basic_info structure defines the basic information array for threads. The thread_info function returns this array for a specified thread.
typedefthread_basic_info_data_t
typedef struct thread_basic_info thread_basic_info_data_t
typedefthread_basic_info_t
typedef struct thread_basic_info *thread_basic_info_t
GNU Mach reference · 7.1.3 Thread Information · © FSF, GFDL
thread_basic_info_t
This is a pointer to a struct thread_basic_info.
macroTHREAD_BASIC_INFO_COUNT
#define THREAD_BASIC_INFO_COUNT ((mach_msg_type_number_t) (sizeof(thread_basic_info_data_t) / sizeof(natural_t)))
structthread_identifier_info
| uint64_t | thread_id | system-wide unique 64-bit thread id |
| uint64_t | thread_handle | handle to be used by libproc |
| uint64_t | dispatch_qaddr | libdispatch queue address |
typedefthread_identifier_info_data_t
typedef struct thread_identifier_info thread_identifier_info_data_t
typedefthread_identifier_info_t
typedef struct thread_identifier_info *thread_identifier_info_t
macroTHREAD_IDENTIFIER_INFO_COUNT
#define THREAD_IDENTIFIER_INFO_COUNT ((mach_msg_type_number_t) (sizeof(thread_identifier_info_data_t) / sizeof(natural_t)))
macroTH_USAGE_SCALE
#define TH_USAGE_SCALE 1000
macroTH_FLAGS_GLOBAL_FORCED_IDLE
#define TH_FLAGS_GLOBAL_FORCED_IDLE 0x4
thread performs global forced idle
macroTHREAD_EXTENDED_INFO
Thread extended info (returns same info as proc_pidinfo(...,PROC_PIDTHREADINFO,...)
#define THREAD_EXTENDED_INFO 5
macroMAXTHREADNAMESIZE
#define MAXTHREADNAMESIZE 64
structthread_extended_info
| uint64_t | pth_user_time | user run time |
| uint64_t | pth_system_time | system run time |
| int32_t | pth_cpu_usage | scaled cpu usage percentage |
| int32_t | pth_policy | scheduling policy in effect |
| int32_t | pth_run_state | run state (see below) |
| int32_t | pth_flags | various flags (see below) |
| int32_t | pth_sleep_time | number of seconds that thread |
| int32_t | pth_curpri | cur priority |
| int32_t | pth_priority | priority |
| int32_t | pth_maxpriority | max priority |
| char[64] | pth_name | thread name, if any |
typedefthread_extended_info_data_t
typedef struct thread_extended_info thread_extended_info_data_t
typedefthread_extended_info_t
typedef struct thread_extended_info * thread_extended_info_t
macroTHREAD_EXTENDED_INFO_COUNT
#define THREAD_EXTENDED_INFO_COUNT ((mach_msg_type_number_t) (sizeof(thread_extended_info_data_t) / sizeof (natural_t)))
macroTHREAD_DEBUG_INFO_INTERNAL
#define THREAD_DEBUG_INFO_INTERNAL 6
for kernel development internal info
macroIO_NUM_PRIORITIES
#define IO_NUM_PRIORITIES 4
macroUPDATE_IO_STATS
#define UPDATE_IO_STATS(info, size) {
info.count++;
info.size += size;
}macroUPDATE_IO_STATS_ATOMIC
#define UPDATE_IO_STATS_ATOMIC(info, io_size) {
OSIncrementAtomic64((SInt64 *)&(info.count));
OSAddAtomic64(io_size, (SInt64 *)&(info.size));
}structio_stat_entry
| uint64_t | count | |
| uint64_t | size |
structio_stat_info
| struct io_stat_entry | disk_reads | |
| struct io_stat_entry[4] | io_priority | |
| struct io_stat_entry | paging | |
| struct io_stat_entry | metadata | |
| struct io_stat_entry | total_io |
typedefio_stat_info_t
typedef struct io_stat_info *io_stat_info_t
macroTHREAD_SCHED_TIMESHARE_INFO
#define THREAD_SCHED_TIMESHARE_INFO 10
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Returns timeshare scheduling policy information about the thread. The returned structure is policy_timeshare_info.
macroTHREAD_SCHED_RR_INFO
#define THREAD_SCHED_RR_INFO 11
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Returns round-robin scheduling policy information about the thread. The returned structure is policy_rr_info.
macroTHREAD_SCHED_FIFO_INFO
#define THREAD_SCHED_FIFO_INFO 12
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Returns FIFO scheduling policy information about the thread. The returned structure is policy_fifo_info.