Ver código fonte

3.13 commit

master
陈越 3 anos atrás
pai
commit
fd586bd63d
2 arquivos alterados com 8 adições e 37 exclusões
  1. +8
    -37
      fun_2.c
  2. BIN
      main

+ 8
- 37
fun_2.c Ver arquivo

@ -13,8 +13,14 @@ void history(char *cmdline)
void print_history(char *argv)
{
int i = num - atoi(argv);
int i = 0;
if(argv == NULL)
{
for(; i<num; i++)
puts(storage[i]);
return;
}
i = num - atoi(argv);
if(i < 0)
{
i = 0;
@ -100,7 +106,6 @@ int Is_pipe(char **argv)
void shell_direct(char **prog1, char **prog2)
{
int fd;
if(prog1)
if(fork() == 0)
{
if( (fd=open(prog2[0],O_RDWR | O_CREAT | O_NOCTTY | O_NDELAY))<0 )
@ -190,38 +195,4 @@ void mytop()
return 1;
}
//tp
//p和ticks
struct tp {
struct proc *p;
u64_t ticks;
};
//cputicks CPUTIME
u64_t cputicks(struct proc *p1, struct proc *p2, int timemode)
{
int i;
u64_t t = 0;
//proc的滴答proc和当前进程prev_proc做比较endpoint相等
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];
}
}
// for(i = 0; i < CPUTIMENAMES; i++) {
// if(!CPUTIME(timemode, i))
// continue;
// if(proc->p_endpoint == prev_proc->p_endpoint) {
// t = t + prev_proc->p_cpucycles[i] - proc->p_cpucycles[i];
// } else {
// t = t + prev_proc->p_cpucycles[i];
// }
// }
return t;
}
*/

BIN
main Ver arquivo


Carregando…
Cancelar
Salvar