Ver código fonte

test mytop

master
10195501441 3 anos atrás
pai
commit
fadcedf6b0
2 arquivos alterados com 24 adições e 2 exclusões
  1. +22
    -1
      yeeshell.c
  2. +2
    -1
      yeeshell.h

+ 22
- 1
yeeshell.c Ver arquivo

@ -677,4 +677,25 @@ void print_procs(struct proc *proc1, struct proc *proc2, int cputimemode)
printf("%6.2f%% in total\n", 100.0 * (systemticks + userticks) / total_ticks);
//printf("%6.2f%% kernel, ", 100.0 * kernelticks/ total_ticks);
//printf("%6.2f%% idle", 100.0 * idleticks / total_ticks);
}
}
u64_t cputicks(struct proc *p1, struct proc *p2, int timemode)
{
int i;
u64_t t = 0;
for (i = 0; i < CPUTIMENAMES; i++)
{
if (!CPUTIME(timemode, i))
continue;
if (p1->p_endpoint == p2->p_endpoint)
{
t = t + p2->p_cpucycles[i] - p1->p_cpucycles[i];
}
else
{
t = t + p2->p_cpucycles[i];
}
}
return t;
}

+ 2
- 1
yeeshell.h Ver arquivo

@ -100,4 +100,5 @@ void get_procs();
void parse_dir();
void parse_file(pid_t pid);
void getkinfo();
void print_procs(struct proc *proc1, struct proc *proc2, int cputimemode);
void print_procs(struct proc *proc1, struct proc *proc2, int cputimemode);
u64_t cputicks(struct proc *p1, struct proc *p2, int timemode);

Carregando…
Cancelar
Salvar