diff options
author | Richard Braun <rbraun@sceen.net> | 2018-06-25 21:56:01 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-06-25 21:56:01 +0200 |
commit | 30dd97fb786ef5f7ca28049684b17bdc2ee7a718 (patch) | |
tree | 330f0514edcfaaa4e3266edb1191c90a39edcb80 /kern/thread.h | |
parent | 0a7c73d2e06172a1210e2bbdfba5718040f4f007 (diff) | |
parent | 7686bfcb703049db5d3711e59133ca4b2259e1f1 (diff) |
Merge branch 'perfmon'
Diffstat (limited to 'kern/thread.h')
-rw-r--r-- | kern/thread.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/kern/thread.h b/kern/thread.h index 6e696fc7..5b5729ce 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -75,6 +75,13 @@ struct thread_sched_data { #define THREAD_KERNEL_PREFIX KERNEL_NAME "_" /* + * Thread states. + */ +#define THREAD_RUNNING 0 +#define THREAD_SLEEPING 1 +#define THREAD_DEAD 2 + +/* * Scheduling policies. * * The idle policy is reserved for the per-CPU idle threads. @@ -323,7 +330,7 @@ thread_wchan_desc(const struct thread *thread) /* * Return a character representation of the state of a thread. */ -char thread_state_to_chr(const struct thread *thread); +char thread_state_to_chr(unsigned int state); static inline const struct thread_sched_data * thread_get_user_sched_data(const struct thread *thread) @@ -705,6 +712,28 @@ thread_get_specific(unsigned int key) return thread_tsd_get(thread_self(), key); } +#ifdef CONFIG_PERFMON +static inline struct perfmon_td * +thread_get_perfmon_td(struct thread *thread) +{ + return &thread->perfmon_td; +} +#endif /* CONFIG_PERFMON */ + +/* + * Return the last CPU on which the thread has been scheduled. + * + * This call isn't synchronized, and the caller may obtain an outdated value. + */ +unsigned int thread_cpu(const struct thread *thread); + +/* + * Return the current state of the given thread. + * + * This call isn't synchronized, and the caller may obtain an outdated value. + */ +unsigned int thread_state(const struct thread *thread); + /* * Return true if the given thread is running. * |