系统时间
CPU
运行在内核态的时间
用户时间
CPU
运行在用户态的时间
真实时间
进程从启动到终止的总时间,包括I/O
时间,CPU
时间,进程切换的时间等。
例
myCp.c
#include <stdio.h>
#include <unistd.h>
int main()
{
int size = 1;
char buf[size];
int n = 0;
while ((n = read(STDIN_FILENO, buf, size)) > 0) {
if (write(STDOUT_FILENO, buf, n) != n) {
printf("write error\n");
break;
}
}
sleep(1);
return 0;
}
运行结果: