sched: track CPU clock cycles used by threads

This commit is contained in:
2023-04-28 21:05:48 +01:00
parent 6b1b4a2416
commit e2131b08ac
3 changed files with 53 additions and 0 deletions

View File

@@ -61,6 +61,10 @@ struct thread {
unsigned int tr_id;
unsigned int tr_prio;
cycles_t tr_charge_period_start;
cycles_t tr_quantum_cycles, tr_quantum_target;
cycles_t tr_total_cycles;
struct queue_entry tr_threads;
struct queue_entry tr_rqentry;
void *tr_kstack;
@@ -84,11 +88,15 @@ static inline struct task *task_ref(struct task *task) { return (struct task *)o
static inline void task_deref(struct task *task) { object_deref(object_header(task)); }
extern struct task *task_from_pid(unsigned int pid);
extern struct task *kernel_task(void);
extern cycles_t default_quantum(void);
extern bool need_resched(void);
extern struct task *current_task(void);
extern struct thread *current_thread(void);
extern void start_charge_period(void);
extern void end_charge_period(void);
static inline void task_lock_irqsave(struct task *task, unsigned long *flags)
{
object_lock(object_header(task), flags);