|
|
@ -15,35 +15,27 @@ |
|
|
|
#define REDIRECT_OUT 1 /* redirect output */
|
|
|
|
#define REDIRECT_IN 2 /* redirect input */
|
|
|
|
|
|
|
|
#define _PATH_PROC "/proc/"
|
|
|
|
|
|
|
|
const char *cputimenames[] = {"user", "ipc", "kernelcall"}; |
|
|
|
#define CPUTIMENAMES (sizeof(cputimenames) / sizeof(cputimenames[0]))
|
|
|
|
#define CPUTIME(m, i) (m & (1L << (i)))
|
|
|
|
|
|
|
|
#define PSINFO_VERSION 0
|
|
|
|
#define TYPE_TASK 'T'
|
|
|
|
#define TYPE_SYSTEM 'S'
|
|
|
|
#define TYPE_USER 'U'
|
|
|
|
#define STATE_RUN 'R'
|
|
|
|
#define TIMECYCLEKEY 't'
|
|
|
|
#define ORDERKEY 'o'
|
|
|
|
|
|
|
|
typedef int endpoint_t; |
|
|
|
typedef uint64_t u64_t; |
|
|
|
typedef long unsigned int vir_bytes; |
|
|
|
#define USED 0x1
|
|
|
|
#define IS_TASK 0x2
|
|
|
|
#define IS_SYSTEM 0x4
|
|
|
|
#define BLOCKED 0x8
|
|
|
|
|
|
|
|
#define ORDER_CPU 0
|
|
|
|
#define ORDER_MEMORY 1
|
|
|
|
#define ORDER_HIGHEST ORDER_MEMORY
|
|
|
|
|
|
|
|
#define TC_BUFFER 1024
|
|
|
|
#define TC_STRINGS 200
|
|
|
|
|
|
|
|
#define _ENDPOINT_P(e) ((((e) + 1023) % (1023 + ((endpoint_t)0x8ace) + 1)) - 1023)
|
|
|
|
unsigned int nr_procs, nr_tasks; |
|
|
|
#define SLOT_NR(e) (_ENDPOINT_P(e) + nr_tasks)
|
|
|
|
#define TYPE_TASK 'T'
|
|
|
|
#define TYPE_SYSTEM 'S'
|
|
|
|
#define STATE_RUN 'R'
|
|
|
|
#define MAX_NR_TASKS 1023
|
|
|
|
#define SELF ((endpoint_t)0x8ace)
|
|
|
|
#define _MAX_MAGIC_PROC (SELF)
|
|
|
|
#define _ENDPOINT_GENERATION_SIZE (MAX_NR_TASKS + _MAX_MAGIC_PROC + 1)
|
|
|
|
#define _ENDPOINT_P(e) \
|
|
|
|
((((e) + MAX_NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - MAX_NR_TASKS) |
|
|
|
#define SLOT_NR(e) (_ENDPOINT_P(e) + 5)
|
|
|
|
#define _PATH_PROC "/proc"
|
|
|
|
#define CPUTIME(m, i) (m & (1L << (i)))
|
|
|
|
const char *cputimenames[] = {"user", "ipc", "kernelcall"}; |
|
|
|
#define CPUTIMENAMES (sizeof(cputimenames) / sizeof(cputimenames[0]))
|
|
|
|
|
|
|
|
struct proc |
|
|
|
{ |
|
|
@ -104,4 +96,5 @@ void parse_dir(); |
|
|
|
void parse_file(pid_t pid); |
|
|
|
void getkinfo(); |
|
|
|
void print_procs(struct proc *proc1, struct proc *proc2, int cputimemode); |
|
|
|
u64_t cputicks(struct proc *p1, struct proc *p2, int timemode); |
|
|
|
u64_t cputicks(struct proc *p1, struct proc *p2, int timemode); |
|
|
|
static inline u64_t make64(unsigned long lo, unsigned long hi); |