10195501441 преди 3 години
родител
ревизия
c7f6c3283c
променени са 3 файла, в които са добавени 27 реда и са изтрити 28 реда
  1. +2
    -1
      .vscode/settings.json
  2. +6
    -1
      yeeshell.c
  3. +19
    -26
      yeeshell.h

+ 2
- 1
.vscode/settings.json Целия файл

@ -4,6 +4,7 @@
"types.h": "c",
"signal.h": "c",
"termios.h": "c",
"stat.h": "c"
"stat.h": "c",
"time.h": "c"
}
}

+ 6
- 1
yeeshell.c Целия файл

@ -35,7 +35,7 @@ char *history[CMDLINE_HISTORY_MAX_QUANTITY];
int cmdline_amount = 0;
struct proc *proc = NULL, *prev_proc = NULL;
int nr_total;
int nr_total = 0;
unsigned int nr_procs, nr_tasks;
int main()
@ -696,3 +696,8 @@ u64_t cputicks(struct proc *p1, struct proc *p2, int timemode)
return t;
}
static inline u64_t make64(unsigned long lo, unsigned long hi)
{
return ((u64_t)hi << 32) | (u64_t)lo;
}

+ 19
- 26
yeeshell.h Целия файл

@ -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);

Зареждане…
Отказ
Запис