#ifndef __INTF_H
#define __INTF_H
#include <limits.h>
#ifndef __VMLINUX_H__
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long u64;
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
typedef signed long s64;
typedef int pid_t;
#define U64_MAX ((u64)~0ULL)
enum {
TASK_COMM_LEN = 16,
SCX_SLICE_INF = U64_MAX,
};
#define __kptr
#endif
#ifdef __VMLINUX_H__
#define MAX_NICE 19
#define MIN_NICE -20
#define NICE_WIDTH (MAX_NICE - MIN_NICE + 1)
#define MAX_RT_PRIO 100
struct bpf_iter_task;
extern int bpf_iter_task_new(struct bpf_iter_task *it,
struct task_struct *task, unsigned int flags) __weak __ksym;
extern struct task_struct *bpf_iter_task_next(struct bpf_iter_task *it) __weak __ksym;
extern void bpf_iter_task_destroy(struct bpf_iter_task *it) __weak __ksym;
#endif
enum {
LAVD_CPU_ID_MAX = 512,
LAVD_CPDOM_MAX_NR = 16,
LAVD_CPDOM_MAX_DIST = 3,
LAVD_STATUS_STR_LEN = 4,
};
struct sys_stat {
u64 last_update_clk;
u64 avg_util;
u64 avg_sc_util;
u64 avg_svc_time;
u64 nr_queued_task;
u64 slice;
u32 avg_lat_cri;
u32 max_lat_cri;
u32 thr_lat_cri;
u32 min_perf_cri;
u32 avg_perf_cri;
u32 max_perf_cri;
u32 thr_perf_cri;
u32 nr_stealee;
u32 nr_active;
u32 nr_active_cpdoms;
u64 nr_sched;
u64 nr_preempt;
u64 nr_perf_cri;
u64 nr_lat_cri;
u64 nr_x_migration;
u64 nr_big;
u64 nr_pc_on_big;
u64 nr_lc_on_big;
};
struct task_ctx {
u64 last_runnable_clk;
u64 last_running_clk;
u64 last_stopping_clk;
u64 last_quiescent_clk;
u64 acc_runtime;
u64 avg_runtime;
u64 run_freq;
u64 wait_freq;
u64 wake_freq;
u64 svc_time;
u64 dsq_id;
u32 lat_cri;
u32 lat_cri_waker;
u32 perf_cri;
u32 slice_ns;
s8 futex_boost;
u8 is_greedy;
u8 need_lock_boost;
u8 lock_holder_xted;
u8 wakeup_ft;
u8 on_big;
u8 on_little;
u8 is_affinitized;
};
struct task_ctx_x {
pid_t pid;
char comm[TASK_COMM_LEN + 1];
char stat[LAVD_STATUS_STR_LEN + 1];
u16 static_prio;
u32 cpu_id;
u64 cpu_util;
u64 cpu_sutil;
u32 thr_perf_cri;
u32 avg_lat_cri;
u32 nr_active;
u32 cpuperf_cur;
};
enum {
LAVD_CMD_NOP = 0x0,
LAVD_CMD_SCHED_N = 0x1,
};
enum {
LAVD_MSG_TASKC = 0x1
};
struct introspec {
volatile u64 arg;
volatile u32 cmd;
};
struct msg_hdr {
u32 kind;
};
struct msg_task_ctx {
struct msg_hdr hdr;
struct task_ctx taskc;
struct task_ctx_x taskc_x;
};
enum {
LAVD_PM_PERFORMANCE = 0,
LAVD_PM_BALANCED = 1,
LAVD_PM_POWERSAVE = 2,
LAVD_PM_MAX = 3
};
struct power_arg {
s32 power_mode;
};
#endif