Threads
| Member Type | Member Name |
|---|---|
uint64_t | rbx |
uint64_t | rbp |
uint64_t | r12 |
uint64_t | r13 |
uint64_t | r14 |
uint64_t | r15 |
uint64_t | rsp |
uint64_t | rip |
| Member Type | Member Name |
|---|---|
uint8_t | reason |
uint64_t | cycle |
| Member Type | Member Name |
|---|---|
uint8_t | reason |
struct thread_event_association | associated_reason |
time_t | timestamp |
uint64_t | cycle |
| Member Type | Member Name |
|---|---|
uint64_t | run_time_ms |
uint64_t | wall_clock_sec |
| Member Type | Member Name |
|---|---|
uint64_t | cycle |
uint32_t | block_count |
uint32_t | sleep_count |
uint32_t | wake_count |
uint64_t | block_duration |
uint64_t | sleep_duration |
| Member Type | Member Name |
|---|---|
MAKE_THREAD_RINGBUFFER(wake_reasons) | None |
MAKE_THREAD_RINGBUFFER(block_reasons) | None |
MAKE_THREAD_RINGBUFFER(sleep_reasons) | None |
| Member Type | Member Name |
|---|---|
uint64_t | run_ratio |
uint64_t | block_ratio |
uint64_t | sleep_ratio |
uint64_t | wake_freq |
| Name | Value |
|---|---|
THREAD_STATE_IDLE_THREAD | None |
THREAD_STATE_READY | None |
THREAD_STATE_RUNNING | None |
THREAD_STATE_BLOCKED | None |
THREAD_STATE_SLEEPING | None |
THREAD_STATE_ZOMBIE | None |
THREAD_STATE_TERMINATED | None |
THREAD_STATE_HALTED | None |
| Name | Value |
|---|---|
THREAD_WAIT_NONE | None |
THREAD_WAIT_UNINTERRUPTIBLE | None |
THREAD_WAIT_INTERRUPTIBLE | None |
| Name | Value |
|---|---|
THREAD_FLAGS_NO_STEAL | 1 |
| Name | Value |
|---|---|
THREAD_PRIO_CLASS_URGENT | 0 |
THREAD_PRIO_CLASS_RT | 1 |
THREAD_PRIO_CLASS_TIMESHARE | 2 |
THREAD_PRIO_CLASS_BACKGROUND | 3 |
| Name | Value |
|---|---|
THREAD_WAKE_REASON_BLOCKING_IO | 1 |
THREAD_WAKE_REASON_BLOCKING_MANUAL | 2 |
THREAD_WAKE_REASON_SLEEP_TIMEOUT | 3 |
THREAD_WAKE_REASON_SLEEP_MANUAL | 4 |
| Name | Value |
|---|---|
THREAD_BLOCK_REASON_IO | 5 |
THREAD_BLOCK_REASON_MANUAL | 6 |
| Name | Value |
|---|---|
THREAD_SLEEP_REASON_MANUAL | 7 |
| Name | Value |
|---|---|
WAKE_REASON_NONE | 0 |
WAKE_REASON_SIGNAL | 1 |
WAKE_REASON_TIMEOUT | 2 |
| Name | Value |
|---|---|
THREAD_ACTIVITY_CLASS_CPU_BOUND | None |
THREAD_ACTIVITY_CLASS_IO_BOUND | None |
THREAD_ACTIVITY_CLASS_INTERACTIVE | None |
THREAD_ACTIVITY_CLASS_SLEEPY | None |
THREAD_ACTIVITY_CLASS_UNKNOWN | None |
struct thread *thread_create_internal(char *name,void (*entry_point)(void *),void *arg,size_t stack_size,va_list args)struct thread *thread_create(char *name,void (*entry_point)(void *),void *arg)struct thread *thread_create_custom_stack(char *name,void (*entry_point)(void *),void *arg,size_t stack_size)voidthread_free(struct thread*t)voidthread_init_thread_ids(void)voidthread_init_rq_lists(void)voidthread_sleep_for_ms(uint64_t ms)voidthread_exit(void)voidthread_print(struct thread*t)voidthread_update_activity_stats(struct thread*t,uint64_t time)voidthread_classify_activity(struct thread*t,uint64_t now_ms)voidthread_update_runtime_buckets(struct thread*thread,uint64_t time)voidthread_apply_wake_boost(struct thread*t)voidthread_update_effective_priority(struct thread*t)voidthread_apply_cpu_penalty(struct thread*t)voidthread_add_wake_reason(struct thread*t,uint8_t reason)voidthread_wake_manual(struct thread*t,void *wake_src)voidthread_calculate_activity_data(struct thread*t)struct thread_event_reason *thread_add_event_reason(struct thread_event_reason*ring,size_t *head,uint8_t reason,uint64_t time,struct thread_activity_stats*stats)voidthread_add_block_reason(struct thread*t,uint8_t reason)voidthread_add_sleep_reason(struct thread*t,uint8_t reason)boolthread_block(struct thread*t,enum thread_block_reasonr,enum thread_wait_typewait_type,void *expect_wake_src)boolthread_sleep(struct thread*t,enum thread_sleep_reasonr,enum thread_wait_typewait_type,void *expect_wake_src)voidthread_set_timesharing(struct thread*t)voidthread_set_background(struct thread*t)voidthread_wake(struct thread*t,enum thread_wake_reasonr,void *wake_src)voidthread_wait_for_wake_match()voidthread_block_on(struct thread_queue*q,enum thread_wait_typetype,void *wake_src)static inlineenum thread_statethread_get_state(struct thread*t)static inline voidthread_set_state(struct thread*t,enum thread_statestate)static inlineenum thread_flagsthread_get_flags(struct thread*t)static inline voidthread_set_flags(struct thread*t,enum thread_flagsflags)static inlineenum thread_flagsthread_or_flags(struct thread*t,enum thread_flagsflags)static inlineenum thread_flagsthread_and_flags(struct thread*t,enum thread_flagsflags)static inline uint64_tthread_get_last_ran(struct thread*t,enum thread_flags*out_flags)static inline uint64_tthread_set_last_ran(struct thread*t,uint64_t new)static inline boolthread_try_getref(struct thread*t)static inline boolthread_get(struct thread*t)static inline voidthread_put(struct thread*t)static inlineenum irqlthread_acquire(struct thread*t)static inline voidthread_release(struct thread*t,enum irqlirql)static inline boolthread_is_rt(struct thread*t)static inline voidthread_clear_wake_data(struct thread*t)static inlineenum thread_wait_typethread_get_wait_type(struct thread*t)
Defines
Section titled “Defines”THREAD_DEFAULT_TIMESLICE:25 /* 25 ms */THREAD_STACK_SIZE:(PAGE_SIZE * 4)THREAD_CLASS_WIDTH:1024THREAD_CLASS_HALF:(THREAD_CLASS_WIDTH / 2)THREAD_ACT_INTERACTIVE_AVG:4000uTHREAD_ACT_IO_BOUND_AVG:2500uTHREAD_ACT_CPU_BOUND_AVG:1200uTHREAD_ACT_SLEEPY_AVG:4500uTHREAD_ACT_INTERACTIVE_MIN:THREAD_BAND_MIN(THREAD_ACT_INTERACTIVE_AVG)THREAD_ACT_INTERACTIVE_MAX:THREAD_BAND_MAX(THREAD_ACT_INTERACTIVE_AVG)THREAD_ACT_IO_BOUND_MIN:THREAD_BAND_MIN(THREAD_ACT_IO_BOUND_AVG)THREAD_ACT_IO_BOUND_MAX:THREAD_BAND_MAX(THREAD_ACT_IO_BOUND_AVG)THREAD_ACT_CPU_BOUND_MIN:THREAD_BAND_MIN(THREAD_ACT_CPU_BOUND_AVG)THREAD_ACT_CPU_BOUND_MAX:THREAD_BAND_MAX(THREAD_ACT_CPU_BOUND_AVG)THREAD_ACT_SLEEPY_MIN:THREAD_BAND_MIN(THREAD_ACT_SLEEPY_AVG)THREAD_ACT_SLEEPY_MAX:THREAD_BAND_MAX(THREAD_ACT_SLEEPY_AVG)THREAD_PRIO_CLASS_COUNT:(4)THREAD_EVENT_REASON_NONE:0xFFTHREAD_ASSOCIATED_REASON_NONE:0xFFTHREAD_ACTIVITY_BUCKET_COUNT:4THREAD_ACTIVITY_BUCKET_DURATION:1000 /* 1 second per bucket */THREAD_EVENT_RINGBUFFER_CAPACITY:THREAD_ACTIVITY_BUCKET_COUNTTOTAL_BUCKET_DURATION:(THREAD_ACTIVITY_BUCKET_COUNT * THREAD_ACTIVITY_BUCKET_DURATION)