+
+#if CONFIG_DTRACE
+ uint32_t t_dtrace_flags; /* DTrace thread states */
+#define TH_DTRACE_EXECSUCCESS 0x01
+ uint32_t t_dtrace_predcache;/* DTrace per thread predicate value hint */
+ int64_t t_dtrace_tracing; /* Thread time under dtrace_probe() */
+ int64_t t_dtrace_vtime;
+#endif
+
+ clock_sec_t t_page_creation_time;
+ uint32_t t_page_creation_count;
+ uint32_t t_page_creation_throttled;
+#if (DEVELOPMENT || DEBUG)
+ uint64_t t_page_creation_throttled_hard;
+ uint64_t t_page_creation_throttled_soft;
+#endif /* DEVELOPMENT || DEBUG */
+
+#ifdef KPERF
+/* The high 7 bits are the number of frames to sample of a user callstack. */
+#define T_KPERF_CALLSTACK_DEPTH_OFFSET (25)
+#define T_KPERF_SET_CALLSTACK_DEPTH(DEPTH) (((uint32_t)(DEPTH)) << T_KPERF_CALLSTACK_DEPTH_OFFSET)
+#define T_KPERF_GET_CALLSTACK_DEPTH(FLAGS) ((FLAGS) >> T_KPERF_CALLSTACK_DEPTH_OFFSET)
+#endif
+
+#define T_KPERF_AST_CALLSTACK (1U << 0) /* dump a callstack on thread's next AST */
+#define T_KPERF_AST_DISPATCH (1U << 1) /* dump a name on thread's next AST */
+#define T_KPC_ALLOC (1U << 2) /* thread needs a kpc_buf allocated */
+/* only go up to T_KPERF_CALLSTACK_DEPTH_OFFSET - 1 */
+
+#ifdef KPERF
+ uint32_t kperf_flags;
+ uint32_t kperf_pet_gen; /* last generation of PET that sampled this thread*/
+ uint32_t kperf_c_switch; /* last dispatch detection */
+ uint32_t kperf_pet_cnt; /* how many times a thread has been sampled by PET */
+#endif
+
+#ifdef KPC
+ /* accumulated performance counters for this thread */
+ uint64_t *kpc_buf;
+#endif
+
+#if HYPERVISOR
+ /* hypervisor virtual CPU object associated with this thread */
+ void *hv_thread_target;
+#endif /* HYPERVISOR */
+
+ uint64_t thread_id; /*system wide unique thread-id*/
+
+ /* Statistics accumulated per-thread and aggregated per-task */
+ uint32_t syscalls_unix;
+ uint32_t syscalls_mach;
+ ledger_t t_ledger;
+ ledger_t t_threadledger; /* per thread ledger */
+#ifdef CONFIG_BANK
+ ledger_t t_bankledger; /* ledger to charge someone */
+ uint64_t t_deduct_bank_ledger_time; /* cpu time to be deducted from bank ledger */
+#endif
+
+ /* policy is protected by the thread mutex */
+ struct thread_requested_policy requested_policy;
+ struct thread_effective_policy effective_policy;
+
+ /* usynch override is protected by the task lock, eventually will be thread mutex */
+ struct thread_qos_override {
+ struct thread_qos_override *override_next;
+ uint32_t override_contended_resource_count;
+ int16_t override_qos;
+ int16_t override_resource_type;
+ user_addr_t override_resource;
+ } *overrides;
+
+ uint32_t ipc_overrides;
+ uint32_t user_promotions;
+ uint16_t user_promotion_basepri;
+
+ int iotier_override; /* atomic operations to set, cleared on ret to user */
+ io_stat_info_t thread_io_stats; /* per-thread I/O statistics */
+
+
+ uint32_t thread_callout_interrupt_wakeups;
+ uint32_t thread_callout_platform_idle_wakeups;
+ uint32_t thread_timer_wakeups_bin_1;
+ uint32_t thread_timer_wakeups_bin_2;
+ uint16_t thread_tag;
+ uint16_t callout_woken_from_icontext:1,
+ callout_woken_from_platform_idle:1,
+ callout_woke_thread:1,
+ thread_bitfield_unused:13;
+
+ mach_port_name_t ith_voucher_name;
+ ipc_voucher_t ith_voucher;
+#if CONFIG_IOSCHED
+ void *decmp_upl;
+#endif /* CONFIG_IOSCHED */
+
+ /* work interval ID (if any) associated with the thread. Uses thread mutex */
+ uint64_t work_interval_id;
+
+ /*** Machine-dependent state ***/
+ struct machine_thread machine;
+
+#if SCHED_TRACE_THREAD_WAKEUPS
+ uintptr_t thread_wakeup_bt[64];
+#endif