91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

This assignment is intended to introduce you to the process manipulation facilities in the Unix/Linux Operating System. You are to implement the program described below on Linux machine.

資源截圖

代碼片段和文件信息

/*#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

#define?FILE_LEN?1024*1024
*/

#include?“head.h“

void?Show_Stati()
{
int?who?=?RUSAGE_SELF;
struct?rusage?usage;
int?success_flag;

success_flag?=?getrusage(who?&usage);

if?(success_flag?==?-1)
{
printf(“Process?statistics?is?unknown.?\n“);
}
else
{
long?user_time?=?usage.ru_utime.tv_sec*1000?+?usage.ru_utime.tv_usec/1000;
long?sys_time?=?usage.ru_stime.tv_sec*1000?+?usage.ru_stime.tv_usec/1000;
long?involun?=?usage.ru_nivcsw;
long?volun?=?usage.ru_nvcsw;
long?iopf?=?usage.ru_majflt;
long?uniopf?=?usage.ru_minflt;

printf(“The?amount?of?user?time?used?(milliseconds):?%ld?\n“?user_time);
printf(“The?amount?of?system?time?used?(milliseconds):?%ld?\n“?sys_time);
printf(“The?number?of?times?the?process?was?preempted?involuntarily?(milliseconds):?%ld?\n“?involun);
printf(“The?number?of?times?the?process?gave?up?the?CPU?voluntarily?(milliseconds):?%ld?\n“?volun);
printf(“The?number?of?page?faults?with?I/O:?%ld?\n“?iopf);
printf(“The?number?of?page?faults?without?I/O:?%ld?\n“?uniopf);
printf(“\n“);
}
}


int?main(int?argc?char?*argv[])
{
?? struct?timeval?tv0;
????struct?timeval?tv1;
????struct?timezone?tz0;
????struct?timezone?tz1;
????int?walk_clock_time?=?0;
????
????//獲取進程運行前墻上時鐘時間
gettimeofday(&tv0?&tz0);
????
sleep(5);
FILE?*file;
char?file_content[FILE_LEN];
int??len?=?0;

file?=?fopen(argv[0]?“r“);
len?=?fread(file_content?sizeof(char)?FILE_LEN?file);

printf(“\n“);
printf(“%s“?file_content);
printf(“The?length?of?file?is?%d?\n“?len); ??
printf(“\n“);

//獲取進程運行后墻上時鐘時間
gettimeofday(&tv1?&tz1);

walk_clock_time?=?(tv1.tv_sec?-?tv0.tv_sec)*1000?+?(tv1.tv_usec?-?tv0.tv_usec)/1000;
printf(“\n“);
printf(“The?“wall-clock”?time?for?the?command?to?execute?(milliseconds):?%d?\n“?walk_clock_time);

Show_Stati();

return?0;
}??

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2097??2007-07-23?04:03??實驗四\shell_prompt\back_cat.c

?????文件???????2077??2007-07-23?03:51??實驗四\shell_prompt\back_cat.c~

?????文件???????9496??2007-07-23?04:44??實驗四\shell_prompt\back_cat.out

?????文件???????2219??2007-07-23?04:03??實驗四\shell_prompt\back_ls.c

?????文件???????2199??2007-07-23?03:51??實驗四\shell_prompt\back_ls.c~

?????文件???????9533??2007-07-23?04:44??實驗四\shell_prompt\back_ls.out

?????文件????????351??2007-07-23?04:03??實驗四\shell_prompt\head.h

?????文件????????351??2007-07-23?03:52??實驗四\shell_prompt\head.h~

?????文件????????351??2007-07-23?04:43??實驗四\shell_prompt\Makefile

?????文件????????345??2007-07-23?04:38??實驗四\shell_prompt\makefile~

?????文件???????6394??2007-07-23?04:09??實驗四\shell_prompt\my.c

?????文件???????6390??2007-07-23?04:06??實驗四\shell_prompt\my.c~

?????文件??????14574??2007-07-23?04:44??實驗四\shell_prompt\my.out

?????文件????????116??2007-07-23?05:09??實驗四\shell_prompt\Readme

?????目錄??????????0??2011-01-04?16:34??實驗四\shell_prompt

?????目錄??????????0??2011-01-04?16:34??實驗四

-----------?---------??----------?-----??----

????????????????56493????????????????????16


評論

共有 條評論