QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2460|回复: 0
打印 上一主题 下一主题

经典任务调度算法的模拟程序

[复制链接]
字体大小: 正常 放大
杨利霞        

5273

主题

82

听众

17万

积分

  • TA的每日心情
    开心
    2021-8-11 17:59
  • 签到天数: 17 天

    [LV.4]偶尔看看III

    网络挑战赛参赛者

    网络挑战赛参赛者

    自我介绍
    本人女,毕业于内蒙古科技大学,担任文职专业,毕业专业英语。

    群组2018美赛大象算法课程

    群组2018美赛护航培训课程

    群组2019年 数学中国站长建

    群组2019年数据分析师课程

    群组2018年大象老师国赛优

    跳转到指定楼层
    1#
    发表于 2021-4-9 15:15 |只看该作者 |倒序浏览
    |招呼Ta 关注Ta

    3 A5 k- A1 t+ b% |9 ]( O, W经典任务调度算法的模拟程序
    * E4 f0 N' f. a0 Q本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。9 N# ?$ b9 c! j. e
    ( I9 F9 v# \3 h! G1 H7 g, S
    编程平台:VC6.0+EasyX图形库环境。, q9 e$ X3 Y! y  O- J! N1 _# \& `

    % M5 c& v# W3 j/ V- U- I以下截取部分程序运行图::) j9 H* h" a. ^+ l0 K' H+ m
    3 W" ?( V2 S% @$ ~* a0 T1 u
    源代码:. S' `3 P' a. U/ p. L! K

    7 [. a" N- m: H( y* Q#include<stdio.h>
    " A! S! O# \% ], S5 [* g1 U3 q#include<stdlib.h>' T' L. s6 a$ W, V" s5 J# M
    #include<easyx.h>2 B3 G) N, o7 |$ s, z; z- L
    #include<time.h>) |% N$ _! \( \$ b4 k
    #include<conio.h>- F( Q- c. D& W: y( O
    #include<graphics.h>! ]$ D% [  l: y- j; V/ l. u
    #define initProcessNum 10
    " a1 N; i1 M7 o. q+ \4 k+ }* M#define initProcessID 1000! D# C5 ~4 c6 ~. u7 b* E
    #define MAXProcessRunTime 10000+ ]& M0 g+ P" Z- D: T! z; Z
    #define MAX_MEMORY  4000
    0 m% s! @; d# P6 B3 B( f4 Z3 w#define exchange_IO_Compute 10% v# ?2 d  D4 }5 @
    #define exchange_process 25
    # R$ x# u5 Z  \/ k: w#define task_completed 1
    & T6 X% m2 W; X& E- c6 A#define task_not_completed 04 ?4 ]9 q* |/ H# c+ }/ |, Q
    #define initclocknum 100
    ' `8 |. C+ B. y, x  |- fenum condition/ H1 E7 j) `4 T6 L# e
    {4 ?" K9 q2 A  x7 t8 v4 C
    dead,computing,IO_waiting,ready" F- a7 P( a+ n' k8 R: I0 Y( K/ `
    };
    2 \. g( Y. Y, b7 Pstruct process: a/ t# m0 r+ }9 L( ^5 P
    {
    1 @/ l+ w: V" ]3 A# Mint processID;
    $ K6 u1 X: F1 J1 H4 ^int comeingTime;
    % }! c* Q$ a+ K( G7 Pint ioNum;/ S" V! Q/ g$ _- ]8 G9 D- r" A
    int computeNum;& p' w# [$ B4 @2 O: u0 T
    int * ioClock;+ W0 ~3 Y! O; B! u: |& E
    int * computeClock;
    & W, b" H/ C4 \- T# Qint ioTime;
    0 @. [. `7 O$ n' Y1 _3 W2 L8 D! uint computeTime;& ?$ l0 Y7 N5 h7 ~7 _  P( i2 }! O
    int askMemory;
    : Z, `: l- s4 J) t* qcondition flag;
    3 V4 H* n% _3 O, C: l- a4 g3 m+ ~int produceTime;  //生成时间,以下三个数据成员用以计算相关性能; m" _8 Q8 k9 x7 x- ~# `( E8 E2 k
    int runningTime;  //第一次占用CPU的时间, l  |% @' K& N$ M4 L  l7 {
    int completedTime; //进程完成时的时间
    5 i. ~- X1 z- G. O};
    / B; C- h: w- {typedef struct processCmpletedInfo  //保存完成一个作业的相关信息
    ; m) ?) X0 O7 x{# B5 E9 R) b, \8 D# ]: o" [
    int processID,comeingTime,askMemory;
    $ I- B4 p# ]. E1 z9 U' ~int compute,waitio,exchange,completedTime,runningTime;
    ! ?( [% {7 ~- A- A$ SprocessCmpletedInfo * next;) z9 S/ {! }" K7 f# y& I6 s5 Z
    }PCI;' J4 E7 \6 d. K7 w) b* ]- j$ P
    struct processPool* n5 p, x" m9 I  V/ A) m- U
    {, Z* q, J0 n1 o4 s4 K
    process * p;1 K6 [$ Y) H3 y0 e' E8 k# [0 I7 [
    int proNum;, @1 f3 i$ X. |- X
    };! z) _. I5 k, f! P( N! A3 l
    int MAX_COMING_TIME=0,ID_FIFO=0,systemClock=0,FLAG_FIFO=0,FLAG_TT=0,FLAG_PF=0,FLAG_SJF=0,FLAG_HR=0,FLAG_show=1;
    ; s* ~  m$ @6 L5 P; ^" {. bint InitPool(processPool * p);9 Z7 \  R: T8 }( w: v. U
    int produce_one_task(processPool * p,int i,int id);
    4 ?: ]* ^& p# y- N- c, Yint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    ) p; t, y) L8 F/ E) I% A. qint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    ' t1 x/ D7 O0 m: t+ x" Jint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);
    - P9 X( n+ M$ K3 d+ M+ Bint FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    , l7 i2 k7 X% J7 I8 M5 J, x" wint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    $ K6 `3 |: h2 lint SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);5 ~! Q4 Y& B3 B
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    . r/ _2 q1 g$ x# `/ R. Dint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    $ m. V: B+ E$ U7 v# Iint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    $ z, h/ H! j4 eint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    ! U6 j. A  U* q/ j/ J
    7 L7 y  T: G+ h
    6 q8 Y/ U8 _* o" V, o8 e" @$ `" Xint sort_by_comingtime(processPool * p,int pos);5 C0 [7 F6 C) B- M3 v- P9 u6 v+ @
    int showProcessInf(processPool p);. L: s" P! f, l) o# k6 O. K
    int drawPerformance_FIFO(int x,int y,int memorry);
    5 L/ ^& d1 J3 N& B# U- ?# @int drawPerformance_HR(int x,int y,int memorry);% D. Q/ O+ H1 Q3 w" C
    int drawPerformance_PF(int x,int y,int memorry);3 f0 K4 R8 G# Q" d$ ^2 v
    int drawPerformance_TT(int x,int y,int memorry);7 I& M3 W0 o% s  ]( M" @
    int drawPerformance_SJF(int x,int y,int memorry);
    $ n# i  i- q( k8 ^$ cint MouseListening();
    ; q* r" M0 K" Rint MouseListening2(int *flagShow,int * showTime);
    0 n0 R4 |" n9 W$ E  Gint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    2 f- @5 k# \" P1 p8 ?6 I( ~& o6 F7 Y% @$ W6 [
    9 F' H2 V/ T1 K1 a3 @
    void main(): \/ C% q$ v" t' l+ ~7 Z5 h
    {
    4 m+ Q+ p( X$ \) I6 c6 G: N# XPCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,
    1 Z2 E2 U9 y6 e" |*Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;9 e  m3 A6 n) Z% `9 d. y; x1 q  \
    int i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,
    2 F! L' e4 G  F3 f. d+ kflagDraw=0,showTime=100000;7 C/ D: t, |& M' q! e( H
    processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;
    % m1 N6 o" e: _: z8 S$ J- h8 j7 _FILE *fp=NULL;# ^& t2 Z1 a6 u; M8 I7 y; }2 f
    //processPool HR_p,HR_mmy;. |$ I( D3 h1 \: h* R/ o- s

    & R1 ^& Q  N2 w" S& d
    : v( Q5 O+ d* n1 Fsrand((unsigned)time(0));& N1 n& i1 {+ n1 ?4 q. T# F. v
    systemClock=0;
      h" l6 S; J4 r) [. C, u& b9 P- u7 g( ~initgraph( 1200,650,SHOWCONSOLE );
    ' x" m3 z& q( d, B7 Ksettextcolor(GREEN);( Q. l) u2 x7 p4 t
    setlinecolor(GREEN);  q, }4 W% C2 U
    setfillcolor(GREEN);
      |" _2 {  ^. }9 v# m; xInitPool(&FIFO_p);
    3 k9 Q; q( A- D4 w, }7 P0 esort_by_comingtime(&FIFO_p,-1);4 ^' a3 C  N. X3 q2 S
    InitPool(&Timeturn_p);3 L/ b& F- n# W) F4 _  ~  W. T: `
    InitPool(&SJF_p);# x2 b3 }5 m. a
    InitPool(&Priority_p);3 u- Z( ?/ a. {! y( S$ y3 y% Z: ]
    InitPool(&HR_p);
    ! b# A$ a  l8 E; r& [& ?//showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    3 x$ ]/ X, Q, ?5 i//Sleep(10000);
    # t* v/ Q6 n. j, M. M6 K% X% O

    ( e  O" l7 [' ]Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ! h+ g& y6 Z* F  a* f4 V, GSJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ( c# J" U! Z8 J: XPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    / d: |, ~+ w" q+ b4 r# l  dHR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ! s" u9 N0 }) K4 t  q, S( [for(i=0; i<initProcessNum ;i++)
    7 M6 D7 H5 i( m{
    3 s- H. N$ N# d/ ETimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));- L5 f! W* F0 H$ F" M; L; D
    Timeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));9 \0 z2 ]$ k6 |" ^, ~4 a2 ?/ y& P( M
    SJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));. K; y" Z/ }: d( _& _- ~- s
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));) ?4 c* ?( c' e% K" s+ N- r  y
    Priority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));# J* [0 ^$ S0 F8 _# B
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));. p8 Y. T5 {" _/ f0 R
    HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    $ v# y3 Z6 X; S9 hHR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    , Y# O. k% U1 V! Y}
    0 n, f/ t* @+ G2 k! w+ z8 ?Timeturn_mmy.proNum = 0;
    $ X( K7 R" w2 i1 `7 s9 fTimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    3 @, Y; f+ y" |/ a" U9 uSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);- Q. T4 ?1 U& \% i* ]
    Priority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    & t5 j9 J- N0 A- o8 xHigh_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);+ E3 r5 z/ I* ~6 G" m
    //showProcessInf(Timeturn_mmy);3 G4 o$ O) x8 q+ E5 S) {
    FIFO_pri = &FIFO_save_head;  L5 Z( ~& k- _' d+ B! R1 c" p" I
    Timet_pri = &Timet_save_head;/ K: O$ X$ m2 W0 v+ @3 H/ v
    SJF_pri = &SJF_save_head;1 E/ O( h' t' W' }4 P
    Priority_pri = &Priority_save_head;
    , h' L) ]/ Z! a. R8 s    HR_pri = &HR_save_head;$ G* _5 D) {2 E- k" X
    setbkcolor(WHITE);
    5 u9 q  G- \3 H  {% Wwhile(1)( ?0 _1 ~' J& }0 U
    {" p/ n- n+ J4 r) \. v  i; s
    if(MouseListening()==1)
    ; z) u6 L# R2 w4 m& L  T! XflagDraw=1;" I2 W; R# j  P
    if(count==100)
    % A/ w) y: H. |0 \4 ^{7 _4 e% U) K2 p
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)
    4 W( N. A1 C+ I) ?1 M{. m* R4 B, O0 q6 N
    FIFO_pri = &((*FIFO_pri)->next);% z2 m- F: Q3 D2 b

    , g! R3 Y+ _6 w# F/ s" |//printf("hello");
    " z2 w0 Y0 `% s% F2 U( ^, Z}; K) e5 P, w) i# x/ _) p
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)
    0 l) }+ a; X& S5 P1 K$ [{
    5 H9 u8 V. [4 k3 Y4 y8 U    Timet_pri = &((*Timet_pri)->next);
    6 f5 }4 C3 i! E0 `; F8 Y* s3 T//printf("hello");
    " K  y3 |0 m% U/ k: \}6 l9 d2 |8 d2 N1 ~& d2 ^
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)3 d+ Q* r$ N0 ^" w7 M: d
    {
    ' p+ [9 x2 a9 OSJF_pri = &((*SJF_pri)->next);6 g, \7 E$ ^4 d9 V$ o" K7 k6 t3 D
    //printf("hello\n");
    ) g& g+ x. V( U( ]}
    % c! t! V5 j: {, c* Yif(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)& u. i" I; V8 O( Y( d% ]/ ]* P
    {
    / _) z) N* Z# h: |/ h6 XPriority_pri = &((*Priority_pri)->next);
    0 q" a: A! q2 S//printf("hello\n");
    ( u! d) j- X( i: u) Q& T' t+ y  o) e}. ~  P) Q' R* m
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)$ R: |- b: |) d1 X- o
    {
    6 W. P% ?* n, t- F$ Y" C, _/ ^HR_pri = &((*HR_pri)->next);8 J7 w/ z; H' ^6 j
    //printf("hello");  {8 B' b, d$ @# f, v6 g) {* D
    }
    5 A0 _, f% W$ Y5 ^! ~2 E9 M# wcount=0;
    7 \" q7 {' J2 m5 `, F7 I$ F; K}
    4 g- [  R! V/ ~2 W/ felse
    & E& A. o: h! A6 i5 V8 b{# W  a% b8 {& h! B& @8 z
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    : T% l2 k$ H" e5 j3 M2 B, D{
    ( V7 s" R5 r" DFIFO_pri = &((*FIFO_pri)->next);
    * \9 I, M; Q1 A// printf("hello");
    " D. B0 W# d  v: S7 j}. k2 W  i+ J7 t4 x
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    8 z5 B* g7 S& M5 }1 e* M8 }8 c{
    # |' N5 M+ m- P: }$ |3 f/ gTimet_pri = &((*Timet_pri)->next);( Y! }9 i9 B0 H4 p1 V
    // printf("hello");
    6 O- {/ D$ i7 U6 B5 i( W. g}
    ' D& n" [  v+ Sif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)8 v- K# w5 X3 @6 s* w; d; o  p
    {
    , j- Z" c4 r0 D; L6 [( d9 e  }   SJF_pri = &((*SJF_pri)->next);9 @$ V9 M* j( p/ S2 B; Z/ d2 }
    // printf("hello\n");
    ; ]0 e! L! p' K( H/ Q  z: H( k}: s& ?$ R( Q3 ^. Y& f3 ]' h
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    % \+ p4 `: h$ s9 B3 b8 i" \{2 T% h9 b! ]1 y. B7 \
    Priority_pri = &((*Priority_pri)->next);5 j3 N& W. j7 @! K& H9 Q
    //printf("hello\n");
    ; z/ V6 P5 m+ k0 V, U}. k3 n( J* X) L9 `, v
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed). ?: J4 P. M+ {" P: `
    {
    ; D6 L+ m+ j- c) L+ BHR_pri = &((*HR_pri)->next);9 ]* }1 N; T. m
    //printf("hello");
    - b9 H' T  M& f//Sleep(1000);  @, H$ O7 i, T" |! `' X% C
    }
    & W+ `3 O9 A9 fcount++;$ y/ @; U  s6 Z+ {1 M0 s# Z
    }
    * ^) F$ F! a* \' r1 p9 `if(systemClock==showTime)
    0 n2 g$ S, l0 C& F{+ f/ l3 v7 X* x# }# q9 z* |
    /*PCI * p=FIFO_save_head;- v3 p9 Z0 X" y3 i( A: O
    int i=0;& K. ?) k' d5 h. R8 L3 w
    for( ;p!=NULL;p=p->next). Z1 R1 [  a1 ?9 L. B
    {# ?8 F6 t4 n5 r$ q1 T
    printf("Id %d\n",p->processID);
    " u' M$ h1 r1 u9 tprintf("comeingtime %d\n",p->comeingTime);
    # W7 v3 W% x% rprintf("runningtime %d\n",p->runningTime);
    3 x! M) a& _, |8 rprintf("asdmemory %d\n",p->askMemory);# S9 f# {6 o0 S
    printf("completedtime %d\n",p->completedTime);& L% L' M+ A7 c% V
    printf("compute %d\n",p->compute);% [" F- B: X2 s6 ^+ d
    printf("exchange %d\n",p->exchange);
    # I* {7 J9 U3 L- U2 q1 S4 m( Xprintf("waitio %d\n",p->waitio);
    * y' Y" |( N" G) ?i++;
    % [5 ~" B! i  t% c8 S% s* R; C' t9 U1 p

    $ g/ v( R% u5 X}
    ' W* q6 q6 k; u% U& m. p4 dprintf("%d\n",i);*/6 f3 O6 ^; @3 a
    if( (fp  = fopen( "data.txt", "a" )) == NULL )  Y. E4 l+ |" ?7 S8 N
    {* @0 Y  j+ m' j
    printf( "The file 'data.txt' was not opened\n" );
    4 v3 ~$ T( c5 w4 a1 b//return 1;
    " i$ A; m7 E9 |- x& o) j, m9 A! |}
    " \) Z$ f! D0 z/ G  p1 T: `& [else, F7 t4 ~2 a5 _  ?0 y
    {
    # d0 |' k4 b) b% sfprintf(fp,"FCFS \n");
    $ {+ v3 |+ D# p& [8 L& Lfor(p=FIFO_save_head;p!=NULL;p=p->next)& F( a' V/ g1 Y
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,5 G0 Q. b6 w$ g- Z5 B
    p->exchange,p->waitio,p->runningTime);
    2 Q& v% w- G: Mfprintf(fp,"\nTime turn \n");
    - {, J- g; [0 E4 |for(p=Timet_save_head;p!=NULL;p=p->next)" p5 H1 R9 D; q
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,8 _) I+ H, ^" t
    p->exchange,p->waitio,p->runningTime);2 [  D  A9 M! x* L2 _% i: T
    fprintf(fp,"\nShort Job First \n");; l# _- ?7 Q9 n: j" X$ v
    for(p=SJF_save_head;p!=NULL;p=p->next)# K, h+ H) x" U3 @' U( {: ?! v, y
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    # K8 m1 X- ~$ t* z- t( Z; |p->exchange,p->waitio,p->runningTime);" f2 b; X* i! V# m/ h" _9 k3 r
    fprintf(fp,"\nPriority  \n");
    ) L) M* B% \; `0 c2 dfor(p=Priority_save_head;p!=NULL;p=p->next)% f" P/ l4 Y8 L! K1 T
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,( u4 J4 _' O' n' ]( w
    p->exchange,p->waitio,p->runningTime);- G; G* I7 n1 v
    fprintf(fp,"\nHigh response \n");0 K0 u5 @4 M9 F& ?7 z
    for(p=HR_save_head;p!=NULL;p=p->next)) _! d& ~8 W# C3 z
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    % K' m  N; @% F3 ?9 O: z: `p->exchange,p->waitio,p->runningTime);7 }+ A+ Z" _8 q3 _2 S( B6 r
    fclose(fp);
    2 x( _7 E* M8 {9 }' l: o& ^}
    1 b: x4 n- A. ~1 t5 T$ U7 xshowRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    / }/ V* r* E. _$ m  D* p0 qMouseListening2(&flagDraw,&showTime);6 J% W! P9 n; s5 q6 J
    }
    1 k3 P0 K: N, JsystemClock++;  ~0 _  V0 F  ^/ I' |
    if(flagDraw==0)
    . j8 b8 y( W  {8 `  Sleep(10);
    ; d4 T, R  q4 J}
    7 V1 m: l2 `- G4 k- L( X3 F) t- B5 ?/ l: [  U

    # c# P( l  a# P- X0 E}
    / r3 |3 {4 i) Y- L$ s+ z+ C# ]int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)( ?0 E1 X9 x5 j2 A
    {
    $ R  ^8 b9 G) g/ `7 p, l$ C8 UPCI * p=NULL,* name[5];
    " R( g& \6 D' S3 p; q( Yint count=0,i=0;
    4 c! j9 I+ s* D- F: Cchar ch[5][10]={"FCFS","timet","SJF","PR","HR"};9 @- l7 s3 v4 C! X" z: P" r. v! `
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    ' G4 m3 R6 H; g$ {9 Hstruct info
    ( x& r7 e+ J2 C! z% P5 W{
    ( Q+ C7 t/ W' t) h2 x4 |* {& Wchar name[10];7 Q8 g. Z, I8 f" i! U
    double throughput,turnover,wait,CPU_rate;
    $ P5 ?) E; [' a& i; s}inf[5];
    " a: M7 t! |1 I7 e, Lname[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;
    % j. R. ^0 M/ D- A: U0 v8 a7 Cprintf("调度算法..........A\n");. q0 C( n( F) W1 J5 t, b: k
    printf("吞吐量............B\n");
    ; M9 P" ~' {5 }6 K& F2 d. |printf("平均周转时间......C\n");
    : R. P0 e* i3 ^% ^printf("等待时间..........D\n");
    8 v! U+ ]( S* rprintf("CPU利用率.........E\n");
    . L( b* G3 I9 K! d+ lprintf("A\tB\tC\t\tD\t\tE\n");, E! i  B1 X+ Q) _+ W2 D
    for(i=0;i<5;i++)# o  t) Z' c  k* v
    {) v+ r6 F+ f9 ^" ?3 `
    count=0,turnover=0,wait=0,c=0,w=0,change=0;
    . H/ g5 {" B7 e# Q3 ffor(p=name; p!=NULL; p=p->next)
    : E( j; j& g) J5 ?7 Z0 S. O{: a1 k+ C, i4 L" E
    count++;% x8 _$ l4 {9 j7 Z" U, k  \# Y
    turnover += p->completedTime - p->comeingTime;/ M( f8 A& N# |5 w' Y2 x4 U
    wait += p->runningTime - p->comeingTime;8 K5 x4 e8 o% T1 l% e5 ?
    c += p->compute;
    . c3 W( w. N0 t& X8 dw += p->waitio;* ]' G2 k7 l0 p  n1 z" R9 c: l
    change += p->exchange;
    3 ]9 u3 ^) H5 ~  H' j0 A2 k4 \}
    5 O/ V& c: u% f# D- x/ jturnover = turnover/count;
    7 J  S5 T  P6 Q! X; E+ c3 R. Pprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));; o4 V! m* J+ Y6 t
    strcpy(inf.name,ch);
    * R) r* I& d$ ^inf.throughput=count;
    , h9 ~' p' v9 Cinf.turnover=turnover;
    & Y, r" U3 a; E' X# Y* q- oinf.wait=wait;
    / h5 p9 F7 V- j9 y1 einf.CPU_rate=c/(c+w+change);
    $ v' M, @$ i/ t3 q. i: P6 n4 V}2 X+ P3 b/ ~* q5 ?3 G5 X
    //画图# j9 {9 Q- u, P1 O) Z% A- e# \
    //cleardevice();
    3 Z4 _- k! G: O3 _7 i. P$ b, }line(0,600,1200,600);
    , X" _  m! N+ s& m2 _) F0 Dline(10,600,10,200);; {' Y) q. b5 r' m
    line(10,200,5,205);& G, z! S# A3 U1 q
    line(10,200,15,205);
    ) m1 B2 Z3 ?+ E$ k) C( ?! vline(310,600,310,200);) x7 [( u" W2 E2 U/ q* ]
    line(310,200,305,205);7 U, `, C# u' L! X2 j( T' D" z# U
    line(310,200,315,205);
    + Q# f" C& m$ I" R% R* y) J# Qline(610,600,610,200);8 {0 Q! x, x# K" r9 F7 [/ o, ~. ^# n
    line(610,200,605,205);
    # D" Z: t& s/ ^# g# I- Fline(610,200,615,205);
    - G* a' e' ~# F1 J# r9 U) }line(910,600,910,200);2 V  ]: w/ m4 F! i  _  f
    line(910,200,905,205);7 f+ t" O: A  W% j, o7 V
    line(910,200,915,205);//最高的长度400,宽度均为40; u! V5 l9 c; x. F- r
    for(i=0;i<5;i++)
    5 K' Z9 l: O( N( W{5 w3 M5 A3 f" p" V
    if(inf.throughput>pos[0])
    + w7 @4 M& [0 E1 Y" lpos[0]=inf.throughput;- Z4 o. n" u' E  |6 N& D
    if(inf.turnover>pos[1])
    7 s5 ]! @  v6 w  kpos[1]=inf.turnover;5 p4 j% f5 e7 p: q" N& c0 j; l
    if(inf.wait>pos[2])
    : y8 [( w5 i" ]: dpos[2]=inf.wait;1 A! i8 u" {/ S( K. q; \* d# p, `
    if(inf.CPU_rate>pos[3])
    , D- K5 w) W& w. |6 v  vpos[3]=inf.CPU_rate;
    # G/ ~3 u, t) `* d. N1 K7 Y8 a/ Q  x}) i' S% F5 W* v% h5 ?
    settextstyle(30, 15, _T("楷体"));  r7 F, c& U; P" i+ ]) {2 t/ K
    for(i=0;i<5;i++)" g& L! ~& F7 L
    {
    9 _9 y( U  E6 ^7 U+ E: _switch (i)
    2 T; h5 e, q! G( }+ h{
    ) k, j; O) P" scase 0:2 ?- B, b! v3 K7 c% f/ j, s
    setfillcolor(BLUE);. y0 t( h4 `3 X# [0 t3 J5 z
    fillrectangle(100,50,150,100);
    , u1 L/ y% }4 D) {# w8 Iouttextxy(160,50,"FCFS");
    " S5 m" _4 p4 P; dbreak;
    - @0 T6 p' p+ Y$ Q6 s/ P. w- O1 Jcase 1:" z% L0 D  \  r' }! C
    setfillcolor(RED);+ V; [5 e4 D  v" b3 t
    fillrectangle(250,50,300,100);
    0 v& ~& {- H8 M! \* }' d+ Louttextxy(310,50,"timeTurn");& d  r% y, Q7 Q6 O) `$ V$ V
    break;3 U- L5 U+ R; \' p5 }! |; g4 W) J
    case 2:
    : x; \) S( X; s9 _( B8 v# gsetfillcolor(YELLOW);! [  L9 E. l; W9 {- ~
    fillrectangle(450,50,500,100);3 S+ j5 T: |! g
    outtextxy(510,50,"SJf");! ~6 g/ k$ i; H8 @/ b
    break;
    ' c9 i; m6 [% U( r% y, }case 3:
    - f/ Q) x0 r/ ?$ @* F% @& E* Lsetfillcolor(BROWN);' J7 j7 I6 f9 g# E: n
    fillrectangle(580,50,630,100);
    6 {8 D6 C* I4 ~& H) B/ {outtextxy(640,50,"PR");- N5 O5 b2 G% R3 i( |: K
    break;
    ' U& {" R0 O6 S' {- S- Vcase 4:' e4 f: i0 d1 K6 X- j& q% U  \, |8 N
    setfillcolor(GREEN);6 W. _1 J0 j) p7 I
    fillrectangle(690,50,740,100);2 J! U# f1 n5 ^- W# L0 [+ P. L2 I
    outtextxy(750,50,"HR");
    . G/ g: c7 Q4 G5 p( o" w& Zbreak;5 U' k. P( ]# b3 c8 w) U" b" V
    }
    & _0 @. ~% C$ T) ]* vfillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    & L' @5 E0 q/ t; r- `$ C- Nfillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    & E0 w5 K# a  }" Hfillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);
    " U- e6 x: |+ p& Dfillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);7 X7 r) h8 s: B! M
    ) l! D9 j' p4 ^" ]: v) ?% Q. ]/ y

    " W3 Q; J3 z$ j$ i6 S- a. k1 D}0 v3 i2 C5 u4 R
        outtextxy(100,150,"吞吐量");8 Q9 h# K2 D4 N; H% Y7 Q) V- L* i' C, x' _
    outtextxy(350,150,"平均周转时间");4 o) F1 G5 u" Q  l
    outtextxy(650,150,"平均等待时间");/ w- }1 C# w+ _" ^, D9 k
    outtextxy(950,150,"CPU利用率");
    + p1 c& w$ |+ K: H- greturn 0;
    ) q; \8 V5 ?) U$ K( O% P}
    ) ?& u3 Q) R/ O) Hint MouseListening()
    : E( W% R3 v% f& @, a# B{
    4 O5 V5 P* T0 [0 _  uMOUSEMSG p;
      s7 g/ J. f7 c) mif(MouseHit())
    2 K! o7 c% l- `  I7 ^, M{% _6 ?% d/ ~" }3 `& _7 D: t
    p=GetMouseMsg();0 y+ {/ y( m  L( }! B2 _
    if(p.mkLButton==true)
    & _& D( n) I/ ?{
    ( V+ p9 J3 H! w$ d8 Q5 sif(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)) Y- t' X2 v! g
    FLAG_FIFO = 1;
    : s+ }. U5 U. a- f- @else if(p.x>400 && p.y>0 && p.x<800 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    . [0 H# G8 O8 D* u6 ^FLAG_TT = 1;
    ) d& y: H0 M; e! R/ }else if(p.x>800 && p.y>0 && p.x<1200 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)) x3 X8 t: s; \4 M! |! l
    FLAG_PF = 1;
    % |, x- a. ]! A: `# F6 }, Gelse if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)- T' k; c( |+ x3 y. }) m
    FLAG_SJF = 1;3 Z$ J- [/ r6 x# {( h
    else if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    . Y# @; o- k  I2 kFLAG_HR=1;
    / n- G0 w4 a, R( Y  G0 k7 nelse if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)5 |4 p( Q( x/ T$ l5 D" \
    {
    ( w! R0 j- L) A! WFLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;$ A% z" [, p! p* \
    clearrectangle(800,325,1200,650);
    6 ?1 L0 [+ }! e9 c! n6 q, c}
    - l$ q. c6 _& n9 J; o$ pelse if((FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0 && p.x>890 && p.y>455 && p.x<1110 && p.y<510 )
    ) D- M- A7 S# _  W$ y7 U' X{9 }3 k2 g$ T% f5 j6 a# X2 k
    FLAG_show=0;2 d% c# I; Z! d0 V1 }1 |
    cleardevice();
    % {5 K8 F5 d3 w0 yreturn 1;) D* r  X- X( V
    }
    & L( S  [1 U& ~}) q! f3 N( ~) V7 [( J& x
    }" k7 O6 I5 z9 I# n: o
    return 0;
    6 c% V" w8 U( v6 j0 c/ x8 g}
    , Z: h1 b" L7 C( d  m3 y/ T7 Qint MouseListening2(int *flagShow,int * showTime)& @- c$ }. Q: c! _( i+ T0 c1 ~
    {
    + G. v2 y6 F. E: {MOUSEMSG p;
    5 G0 H9 P5 j. ~) d: s4 frectangle(1150,0,1200,50);9 K4 M9 V' G: W& L
    outtextxy(1160,10,"X");
    3 y; z1 o: g7 m- J" a9 a: d' s9 ]while(1)
    8 b0 v" ]# E3 E- w. [& Y; C{
    ; z2 s. d5 @; s- Uif(MouseHit())
    8 G4 X( S7 s: W8 o- h7 e' T$ O{% Q! d- M$ b# R+ n5 f- I" y( a4 i
    p=GetMouseMsg();
    1 Z* D/ I5 W! D& Oif(p.mkLButton==true)1 d9 V) ]; X/ [  T! \- R1 m& {) p
    {- c2 M- X0 C# t2 y6 ]9 w* }% a0 G
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )
    ) O6 V& @7 W% e" F. Q2 O{
    / h) n+ E* f  ?  B- v& F. d(*flagShow) = 0;
    $ ]) v# z7 B! O$ f(*showTime) += (*showTime);" i0 D, C/ ^6 b) N4 f
    FLAG_show=1;- G1 F( x0 ?, }
    break;
    2 t$ H, p5 k. i& d% `}
    # {# u( V! S$ [2 y6 M
    & ]8 p; u* G- Q3 U  `}
    2 i: b# X) [! R9 T3 J}
    ' Y" o! x3 a$ d' W! RSleep(20);
    % l! ?; }7 A5 D/ Z  I6 l1 M& @}" M7 I8 H* W! b7 [4 X
    cleardevice();
      w6 V* _: [  D* s; zreturn 0;
    1 c$ O/ Q, A# Q+ ]' E$ x}
    0 a, _  S9 S6 E% Y. L" D4 pint drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)
    4 W. {* D4 G' R! i% N* ^{
    $ P$ g% t+ _2 v, \5 u) G7 z) Jstatic int info[11][3],num=0;! |, K& D& [! G9 d$ V
    int i=0,j=0,pos[10][3][2];
    / Z9 K- p; N' y- t$ jfloat temp,t;: d" h3 R- u3 m
    //画按钮,不属于FIFO图的范围
    & ]4 {% O* N% f2 `! xif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)! r' |) t9 t3 U" s
    {7 Q( ?" e' L$ D7 u7 y# o+ {  b9 |
    settextstyle(30, 15, _T("楷体"));
    ; [% Q7 V* c* {+ f* G7 Urectangle(890,455,1110,510);
      W0 [. j* l) R5 zrectangle(900,465,1100,500);
    + _$ {- e" k* Q/ I/ c/ Louttextxy(910,468,"查看运行结果");0 x: m0 Q9 f0 a4 P( L2 y* \: q$ I
    }+ c" y! J) h8 J! R: X# h
    //结束画按钮9 \/ P1 w8 A0 D: c, w5 K* [
    info[num][0] = com;
    : P% S, }+ e- n3 I- kinfo[num][1] = wai;. ?7 `& s" E. |( Y5 J/ e
    info[num++][2] = cha;
    $ S' B9 ~: v( d) V& G. m" Lif(num>10)  //存储10个点) j1 i- |& f; f1 \$ f+ I
    {0 |0 o8 f( Y& k8 i
    for(i=0 ;i<10;i++)$ E" I9 [' h! R6 V+ J
    {: i! G* C( K" w9 R+ j1 `& O) k
    info[0] = info[i+1][0];
      P9 u# X! i% w' q/ {7 ~5 Jinfo[1] = info[i+1][1];
    - @; Y. Q6 s% |" yinfo[2] = info[i+1][2];
    8 S5 x, G8 i$ K1 v) o) K" Q}# e& {8 l; B/ T  g' H/ V' O
    num--;0 M% _. Z: S9 d4 z2 k* J- R
    }# }! g$ s& ^3 s2 C  E- x- ^6 O
    if(FLAG_show==0)9 C* A+ E+ A" E1 P
    return 0;' t4 |0 n; a7 ~
    for(i=0; i<num; i++)$ _7 {4 Z/ N2 I7 T( y1 U
    {
    4 K' c: S+ O, E7 }t = (float)info[0];
    ; D; X! m! s, ^7 f6 j/ i, [2 Ftemp = (t/101)*90;
    . x  g* \! u5 hpos[0][0] = (10-num+i)*25+x+100;' g& d6 N; Z9 w* d$ h4 Z2 s
    pos[0][1] = y+110-(int)temp;
    9 O* X; J3 k- g0 q- n/ n# Z, k; V0 b0 ht = (float)info[1];
    ! r  ]/ X/ Y1 ]5 f* d3 ltemp = (t/101)*90;/ n- }( O9 m; h; N+ O: Y- C) l! o9 D
    pos[1][0] = (10-num+i)*25+x+100;
    # i+ L$ p: J* W: t  W% |pos[1][1] = y+210-(int)temp;
    0 C1 c+ B  k1 k5 z  f" Ct = (float)info[2];1 V, x" I+ T; ^1 `, k" H1 K7 P
    temp = (t/101)*90;& y' }6 M' ]8 t6 s1 W. R7 P6 ?
    pos[2][0] = (10-num+i)*25+x+100;; ^, u- k* W; k- O
    pos[2][1] = y+310-(int)temp;& j7 D4 |$ g6 J+ H7 H
    }
    1 H1 f- b, Q  f! z& H: P( Hif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    5 O: s# v$ a1 d2 c; D7 Y{
    2 Q. g8 q( R3 zclearrectangle(x,y,x+400,y+315);
    % Q5 \" ]5 R; d& G  E: U6 xsettextstyle(20, 10, _T("楷体"));. h6 `5 z8 C: C0 F  v/ ^6 U
    rectangle(x,y,x+400,y+325);
    0 S* p$ X; Q' P7 F6 touttextxy(x+40,y+10,"CPU");       //画柱状图
    # v7 t% D$ Q$ q- Q+ ?* t& Couttextxy(x+45,y+10+100,"IO");
    ) ?6 p8 h6 _) z+ b! C% y6 j  Jouttextxy(x+40-15,y+10+200,"change");! C# t4 C" T, T1 s% D5 a  d
    rectangle(x+35,y+30,x+75,y+110);4 Z( p$ i1 n4 r+ k6 a
    rectangle(x+35,y+130,x+75,y+210);
    7 X& j" ~; T3 I; W- frectangle(x+35,y+230,x+75,y+310);
    8 ?. W9 O( n$ x5 e/ q, eouttextxy(x+180,y+310,"FCFS");
    1 D' x4 U2 K6 W, U) Z  C0 D9 ot = (float)com;
    , j% p- [. n$ k9 F7 Ztemp=(t/101)*80;
    7 I3 ~( S) c1 z: h# dfillrectangle(x+35,y+110-(int)temp,x+75,y+110);  A" v' G( d  d0 c, X, p
    t = (float)wai;. b  V( r+ T6 O* W  k
    temp=(t/101)*80;
    6 U4 Y: w( k. ?, @  Zfillrectangle(x+35,y+210-(int)temp,x+75,y+210);' M$ t1 x+ O- u8 z
    t = (float)cha;
    9 `+ K' f5 w2 y; _) x4 wtemp=(t/101)*80;
    + T- Z. _0 U2 ~( ufillrectangle(x+35,y+310-(int)temp,x+75,y+310);* X5 ^) M& [; c7 P" |
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    / }9 @% l9 q' w/ J# X  H6 `{, ?+ M) R* j( y6 ]
    line(x+100,y+110+100*i,x+350,y+110+100*i);: p; n( y( k0 \# c0 [
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    1 a/ k  O0 V& ]0 r3 Lline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);  o  x. l) O7 h. }! G& }( Y' L
    ' H& x! r( O8 E5 _9 J
    line(x+100,y+110+100*i,x+100,y+20+100*i);2 r( N5 l# K1 K) M+ G$ K2 m
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    & J: e4 ~' h- f/ h0 S5 V: tline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    3 w3 K6 J9 f# i# a0 @3 zfor(j=0;j<num-1;j++)
    / C* u  {5 R+ R8 A" Z" N+ f$ y# C{) o7 s& S9 r/ ?5 b- S* i
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    7 |1 x/ [/ p7 O/ F4 Q: E. H/ dline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);: m0 l0 a& `5 e- C6 I7 H7 S
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); / m6 f+ L. Y! i
    }" g2 p, o5 v0 {. s6 M
    }, Q7 i6 e) u" {! }! y
    }% k% Z4 V* c& E; J
    else if(FLAG_FIFO==1)
    # I/ n6 @% A7 @( N{! g9 `7 ~4 x# Z  c$ {, H- c( N/ ~
    x=0,y=0;9 U4 L3 w# O& p- a
    for(i=0; i<num; i++)1 s* ]. N/ P; l9 X
    {
    ' {0 l) o7 o4 C. k& O; q8 e. x: kt = (float)info[0];% c- ?2 F- q8 U" V4 B. ^* c6 g
    temp = (t/101)*180;
    1 B3 s) c. P" }) |* I7 O, kpos[0][0] = (10-num+i)*50+x+650;
    * r4 m' J, p- r* l8 u$ [$ Jpos[0][1] = y+210-(int)temp;) Y5 r% w2 V/ T
    t = (float)info[1];" v1 d. [# c( |! ]5 s6 x0 i8 z
    temp = (t/101)*180;
    , r* {) C' Y7 s+ Qpos[1][0] = (10-num+i)*50+x+650;
    3 I& v5 i6 N1 B" y; S% W7 o% |pos[1][1] = y+420-(int)temp;
    ; y: i( ~6 a/ s8 J2 ot = (float)info[2];/ ~. w/ R  }( A
    temp = (float)(t/101)*180;
    ; S) |/ K5 F* a1 Z$ ~. fpos[2][0] = (10-num+i)*50+x+650;$ x# [6 q4 c) b$ L4 @7 ~: A
    pos[2][1] = y+630-(int)temp;
    - n8 M9 j6 d; M' i}, `  T8 L# x! N6 H5 p) e, ~
    clearrectangle(x,y,x+1200,y+650);
    $ U) F$ J( A5 j9 v! Gsettextstyle(40, 20, _T("楷体"));
    ; a2 Z7 U$ x$ l1 Nouttextxy(x+50,y+50,"FCFS");3 E0 n# B' k. S( @- f: E
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    ! I0 p6 h" N9 E" nouttextxy(x+285,y+20+200,"IO");$ l. @- f( a. Q  O
    outtextxy(x+250,y+20+400,"change");! {  D: V* w3 ^; y
    rectangle(x+270,y+65,x+330,y+215);
      Z' C( S% ~# W. krectangle(x+270,y+265,x+330,y+415);
    - {) o) t2 K3 p0 ]/ prectangle(x+270,y+465,x+330,y+615);
    9 Y8 k9 v+ t3 r! i/ _4 x2 D( Mouttextxy(x+290,y+620,"TT");
    , [) b5 b% d# Q. ~0 w  Q. St = (float)com;
    / j: d3 {, r2 {+ i# q& ]! ktemp=(t/101)*150;$ `& m+ r& u; y# A7 M
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);1 G7 }) _/ S8 F5 q% b* n
    t = (float)wai;! F; l7 c$ a% V: M% E$ y4 B
    temp=(t/101)*150;/ m/ ^- k; `0 P, o. _6 A
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    8 F; K5 Z7 j; q: I$ U2 Jt = (float)cha;" b6 T$ d! }$ d! ~" y
    temp=(t/101)*150;# a* ~3 _; u& v, e% ?' R
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);' Q; ^' h1 W, i: C
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
      h* O9 Y  t$ B/ S% Q3 U{" a7 ]4 ^! R' Z
    line(x+650,y+210+210*i,x+1150,y+210+210*i);7 l5 O$ F& y5 n- v
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    7 I& p# H" O" b3 T, }! `# R$ k8 _8 Cline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    7 p& M" ^- x6 o! [/ W2 W5 z/ S- r. e
    4 M$ c, d8 w7 ~5 r0 J  C( a( tline(x+650,y+210+210*i,x+650,y+20+210*i);
    6 ]4 g) d5 L" |' C2 n% Wline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    / Y  v5 Z2 v7 \2 N8 X. jline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);* H2 Q- d3 D0 p$ W$ `
    for(j=0;j<num-1;j++)
    0 a5 O' i8 q' C/ R! L2 Q* p{  ?* H: g4 p/ Q3 I& M
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ' M+ a& g3 [) T- q2 Yline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);- Q* ?. z8 [* ]/ C3 }& d
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ) X- \9 b+ B1 |( J# ^
    }8 v. q  o& W) N- ]
    }
    $ l: y5 r6 b6 u( C- Z}
    & y8 ^$ v% E- z+ J
    6 u- t2 w( a6 i6 b- ^& G: k+ F2 e  Y9 y9 ~) H
    return 0;( I2 ?5 t* H! d' Z/ `
    }: _! a, y& e8 a) I
    int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)
    % U% L$ U9 o5 W{) I. }3 H- ~) h
    static int info[11][3],num=0;/ ^1 x4 z8 x: {6 m5 ^. ~
    int i=0,j=0,pos[10][3][2];
    + V8 x/ w8 T# a) C2 [& I9 }float temp,t;
    + W' P4 |2 l6 A# Ainfo[num][0] = com;* q: M- B; z3 q" L/ R
    info[num][1] = wai;/ [( C0 K$ E4 o/ c5 X- N
    info[num++][2] = cha;; ?7 E" ~5 |( m3 }8 N0 S" Z
    if(num>10)  //存储10个点/ E% y# P$ W9 j7 o+ {
    {- Z7 y8 |( L8 z- a# M1 b3 ?8 V
    for(i=0 ;i<10;i++), S$ P7 s5 D6 T8 X( K1 x$ L
    {
    - |& C8 L  g  e8 y. }  [. T0 v* S. q% pinfo[0] = info[i+1][0];& ~6 k. o7 h2 X8 H! N, G8 ]
    info[1] = info[i+1][1];. A3 C( Q! G, B' G
    info[2] = info[i+1][2];
    ' K; W; c1 E$ W}
    & m) m% l' p0 m; [6 ?  r4 Hnum--;. L  @; C+ [1 ]' m% |2 m
    }
    , {0 O& ~1 h3 J; p: f: M2 Sif(FLAG_show==0): F4 F3 l; c! \' d& U8 S7 w$ m
    return 0;
      C3 p$ e! ^+ @8 P; M/ ffor(i=0; i<num; i++)
    3 ~! w- N# [; R1 f/ p+ i" B7 R{0 L* y- W( w& a. j+ ^
    t = (float)info[0];
    2 U& M9 X! T% d' z6 h9 ?$ N: `  mtemp = (t/101)*90;1 M. ^+ S9 k1 A5 K
    pos[0][0] = (10-num+i)*25+x+100;
    3 t* D, Z# D0 K" H+ w6 z7 epos[0][1] = y+110-(int)temp;
    6 e% y' w+ ^# _0 p) ot = (float)info[1];
    ; p, H' P1 u5 W* z7 v' S9 \temp = (t/101)*90;
    # ~) k/ d1 J# u& N1 d* l8 t& Fpos[1][0] = (10-num+i)*25+x+100;
    + n- {* d2 }4 P+ O6 J  r/ Npos[1][1] = y+210-(int)temp;0 e. {2 F8 {" U, R. [" Y
    t = (float)info[2];" B3 T) E! k; O
    temp = (float)(t/101)*90;7 ]  [( S6 {) R3 v) C0 c/ \
    pos[2][0] = (10-num+i)*25+x+100;2 s+ ~6 J/ R" B2 x+ e
    pos[2][1] = y+310-(int)temp;
    * @0 H7 w8 R: l- ~7 B9 X0 C}$ [$ p3 o8 g* B8 N' }, n
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)3 c& t( q5 E  t/ e
    {
    3 X5 ~1 I) c9 Y( c5 ^' h. Sclearrectangle(x,y,x+400,y+315);" O1 I6 C& I3 l# K6 b
    settextstyle(20, 10, _T("楷体"));
    / A6 U" E0 H# a& g. r, n% k; Irectangle(x,y,x+400,y+325);( N, x% q. K, `4 C
    outtextxy(x+40,y+10,"CPU");       //画柱状图( g. B$ G4 \) x9 t+ |/ |* W* ]& O  E
    outtextxy(x+45,y+10+100,"IO");
    . R6 W1 V% G" F( q! L( Bouttextxy(x+40-15,y+10+200,"change");! H0 G( P/ }3 v' F
    rectangle(x+35,y+30,x+75,y+110);
    4 z, b" g2 R0 |! G1 v3 ~rectangle(x+35,y+130,x+75,y+210);
    3 A2 ^5 A1 Q9 {$ [rectangle(x+35,y+230,x+75,y+310);
    $ f0 |: z7 W, \/ Oouttextxy(x+180,y+310,"HR");( B; v+ L" J5 B! }5 E  L9 k
    t = (float)com;8 P  o6 |# x( b$ h
    temp=(t/101)*80;6 m& X4 b( ]- K( W& f: G
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);+ k  R- O6 w0 p4 z! d3 v4 [
    t = (float)wai;0 J% i* i; Y' O% \
    temp=(t/101)*80;
      f5 ]$ X" n; N2 C9 Z; Nfillrectangle(x+35,y+210-(int)temp,x+75,y+210);4 x9 V' g4 W, A  X% A
    t = (float)cha;7 p* u) }1 V& e6 ^: a0 Q* Z6 D* s! R
    temp=(t/101)*80;
    : ^: j$ x( O, H* Rfillrectangle(x+35,y+310-(int)temp,x+75,y+310);) B0 r" o4 E( K6 d. d) W5 [; X
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ' Z% E2 o9 @( Z* T4 Y4 d$ w{
    * u! X$ o+ r9 E1 O( `line(x+100,y+110+100*i,x+350,y+110+100*i);. }# ^3 a6 ?) v7 ]$ h8 Y
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    + i- N' n4 x) @: U+ oline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    " ^2 s5 s( X, P& B5 M; `2 \7 X  K2 J" k% k
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    1 q( V. u3 r0 g! n, b3 z: y: [line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    0 S8 z: Y7 u8 Iline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    ; |/ k; P& e% f' m- u+ P$ X9 q" mfor(j=0;j<num-1;j++)
    ) f+ L2 o4 V0 j+ E  q{
    6 h. C7 z. T0 ?line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    9 v9 c# E2 J" K1 eline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);, L2 O5 e; ~0 a% g- S4 u
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 5 x7 c" G1 p# x7 e/ r( @+ B" b# w
    }( h' G# I2 ]# y+ K
    }& E: x5 Z9 R; W) d+ o, ~8 m  f
    }% v& }7 @# m. o; t1 C; t' y& `
    else if(FLAG_HR==1)
    " S7 @) ]; Y% C# X{: s( J8 T$ L  K8 w0 s
    x=0,y=0;1 z8 t% q: u, ]4 b$ e: A* z
    for(i=0; i<num; i++)
    ! b' }& j) T6 F. p7 h1 s{3 H% I1 E! R+ V9 N
    t = (float)info[0];  u( L. B5 n* F: E( A# H& |" p
    temp = (t/101)*180;3 {& C+ O1 G9 J4 _2 V4 [
    pos[0][0] = (10-num+i)*50+x+650;) R+ W3 n' f, F, O- J  ~1 t! _
    pos[0][1] = y+210-(int)temp;+ E" j) Y4 Z9 ^/ |7 j6 [# r& f
    t = (float)info[1];/ B+ x& ^1 o$ y1 z( p  i
    temp = (t/101)*180;
    3 e+ F  @# n& n5 I# e: l" K# tpos[1][0] = (10-num+i)*50+x+650;
    / T: z4 D! t" \pos[1][1] = y+420-(int)temp;
    8 k) {( K! O' A7 _t = (float)info[2];- N" V! ~0 I2 J, S  @
    temp = (float)(t/101)*180;
      H3 {: K$ G& D) _8 y. h& F5 r4 upos[2][0] = (10-num+i)*50+x+650;
    ( S6 d0 n" C4 W" p, N; cpos[2][1] = y+630-(int)temp;
    3 H# x2 d4 B) g}5 c8 }) g, W. s6 r
    clearrectangle(x,y,x+1200,y+650);
    - O3 |& S0 t  j% usettextstyle(40, 20, _T("楷体"));
    & j: h5 _. S: c9 Q6 qouttextxy(x+50,y+50,"HR");+ W! E! F" A9 C3 l1 q/ N% C
    outtextxy(x+280,y+20,"CPU");       //画柱状图4 J0 c; K* o1 u# Q+ d3 c) ~
    outtextxy(x+285,y+20+200,"IO");
    * I' n8 m4 @, d7 pouttextxy(x+250,y+20+400,"change");4 ~1 a1 Q! Y+ y% X
    rectangle(x+270,y+65,x+330,y+215);
    # I3 D; P  H. ]5 O5 p' B( A7 d1 irectangle(x+270,y+265,x+330,y+415);
    ) I, H! }9 {8 c$ }5 N+ G2 Arectangle(x+270,y+465,x+330,y+615);4 w- v- A- l; P2 d8 M5 b3 D
    outtextxy(x+290,y+620,"TT");2 c- r$ U! m- H3 L1 C
    t = (float)com;
    * m' r8 ?  E$ q  X5 ~5 e* vtemp=(t/101)*150;
    9 Z, m+ N. q: S+ b: [fillrectangle(x+270,y+215-(int)temp,x+330,y+215);& p9 l" U! b6 a. O# e
    t = (float)wai;, Z! u4 f* h* M4 _3 X
    temp=(t/101)*150;  C" W8 Z  Y2 S0 |# I' A
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);& f7 @. _) z. r
    t = (float)cha;6 }! F  S0 h; q) E: o2 O, P3 S
    temp=(t/101)*150;
    4 x; N. \: Z3 O' h% afillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    ( o& S& |* [. Z7 ^# V% I3 pfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    $ l8 H# O% G( H) R{
      p/ h2 q- Z0 y3 {4 w- Dline(x+650,y+210+210*i,x+1150,y+210+210*i);+ H; ~) n5 l0 t  ~6 P" m
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    4 g% q& d, U' o2 k- ?0 ~! nline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);  ]* H! {0 n; O% a3 ]. i* W
    % W  o+ F5 ~1 \+ E- L: W$ f: N
    line(x+650,y+210+210*i,x+650,y+20+210*i);3 |9 e8 N( M" Z( ~
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);3 P8 B. Q  @7 B3 p% G. D( K
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);, s2 t2 T0 X& v" B, X
    for(j=0;j<num-1;j++)- \" }* E4 t# z, [6 h7 ~
    {
    , Z$ M; P$ p5 q4 E% A, e$ N) Dline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);8 @$ r0 ~) G" C4 E3 k. f& s0 b
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);0 l8 E8 d; n, s
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ( b6 b$ t( I* }4 |0 \  M
    }0 Y% ~3 J: T; }$ y8 J) x* G
    }& l' C4 j1 a# M# l% w& E
    }
    8 V7 ^8 p- w6 P! K1 f/ [1 |
    & S0 }+ I8 D2 D3 H+ I% r+ H
    ; s9 k) ^& ~' v  j6 ~- ]return 0;+ n( g2 L/ a2 M7 j" Q% G' K2 V
    }
    ; E, o( {! ]- s" w; w2 {, Yint drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)+ H2 N, _7 u& z% j6 b2 G3 r+ H1 Q
    {* G+ P' b" \) D" p' I0 \
    static int info[11][3],num=0;
    7 v. B6 o* b5 j9 Yint i=0,j=0,pos[10][3][2];6 k- ^- M( B  T* h* V/ E( X
    float temp,t;
    8 [- J. c" u# y8 Q: i& winfo[num][0] = com;
    , R, x, R1 N$ c9 [) Pinfo[num][1] = wai;
    8 w  y3 M; c7 Y8 s8 I0 b. }5 O, pinfo[num++][2] = cha;
    . E7 f2 q, s( _& `# o- e) }3 ^if(num>10)  //存储10个点1 v6 k0 S' U$ _& N5 P2 V9 ~
    {+ ^& e1 O5 ~/ k
    for(i=0 ;i<10;i++): c) P. @9 a5 C; X7 j& }4 J) H
    {
    , z7 D  o$ }5 I/ U: J0 tinfo[0] = info[i+1][0];( A1 b' d2 E  P, I: x  f( m
    info[1] = info[i+1][1];* a1 E8 Y- {0 w9 o. ]" c
    info[2] = info[i+1][2];
    ! b  x0 m* t. J6 P. [}$ U* i, o8 Q& \9 t/ `" H$ ?3 R
    num--;$ n) F. s/ O5 M( Z
    }1 ~1 e: _2 i) G, ?
    if(FLAG_show==0); `) L7 x6 L, j" k8 H/ \7 K/ @
    return 0;( \" q0 e& Y; I3 Z( Z  i
    for(i=0; i<num; i++)
    3 }( ^2 [2 d# v$ f- j{+ n' ]/ ~2 \- q1 Q* |  i
    t = (float)info[0];8 H& ~, |7 T6 d1 E( ?. H
    temp = (t/101)*90;2 U7 @  {. Y' d. s1 e, n) }' [# T% j
    pos[0][0] = (10-num+i)*25+x+100;
    # _$ y: i' T2 wpos[0][1] = y+110-(int)temp;
    9 B; c$ R( U$ H& {& Pt = (float)info[1];$ r1 j. X4 ]/ Q7 C# I: V
    temp = (t/101)*90;
    * ]5 I  q$ w, }pos[1][0] = (10-num+i)*25+x+100;: G- Z' _% F$ C$ v, ?
    pos[1][1] = y+210-(int)temp;
      ~0 g, _6 b; T: v4 J$ U) J, Ot = (float)info[2];: `" O- w/ \" I; h7 T3 b1 C
    temp = (float)(t/101)*90;
    8 E! |# W7 z9 R) Jpos[2][0] = (10-num+i)*25+x+100;. S! x6 K8 K( v3 j8 I
    pos[2][1] = y+310-(int)temp;
    3 g- b- |. v7 {' ^- ~7 _}% H) t$ M' A; U( R- k$ R: X
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)3 J* t  ?9 Y3 H! E2 J, N
    {
    2 T: `' W! t5 ^3 xclearrectangle(x,y,x+400,y+315);7 `+ x5 O: i/ A$ ~
    settextstyle(20, 10, _T("楷体"));  q, e# w* k, b1 K# k4 e4 `; _
    rectangle(x,y,x+400,y+325);
    9 j) V8 e, @# T7 houttextxy(x+40,y+10,"CPU");       //画柱状图
    7 E8 g0 X& T& x0 iouttextxy(x+45,y+10+100,"IO");& V. g4 U: y) i1 J
    outtextxy(x+40-15,y+10+200,"change");
    , L+ c$ M% C9 i: L( ]9 z& `rectangle(x+35,y+30,x+75,y+110);
    / j# m* r# [8 a5 erectangle(x+35,y+130,x+75,y+210);' m% g! O) I4 i7 l
    rectangle(x+35,y+230,x+75,y+310);1 x8 a- b) N: [7 M- V" I
    outtextxy(x+180,y+310,"TT");
    " Z& k) A' o8 p4 ]) H7 V3 L# Dt = (float)com;
    / d6 v. D6 K8 |temp=(t/101)*80;
      i4 C% L2 R. j' d' G9 `fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
      j. d( k2 ~# w  Y' }5 `t = (float)wai;
    ! ^' m  v% ~1 v" j( @- J/ h  Xtemp=(t/101)*80;- `8 H% |2 n' j/ O
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);! J2 z- G9 S" I; a* m: X
    t = (float)cha;: I( s1 @5 e% v3 _# E# T7 ~
    temp=(t/101)*80;
    ' L4 J+ h8 A8 Q; Ufillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    2 C% f) X4 z( [8 M0 x! F& efor(i=0; i<3; i++)   //画坐标   high=90,length=2506 v; Z2 L; z+ S% i
    {
    + e2 `* p: m5 f$ ~line(x+100,y+110+100*i,x+350,y+110+100*i);
    0 N- P. f# N& l- Y) b* {' lline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);: l3 a) j4 r/ H1 g0 \+ b5 ]
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    ! S4 `3 F+ h7 i4 e- x- ?6 D$ @7 B, E6 G8 d6 o, F2 `
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    . r, s' E6 L' A4 Qline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    4 F% a; s) l' L; w' pline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);0 n% ~" `6 H) E# k# I8 @
    for(j=0;j<num-1;j++)4 ^2 X0 B8 _" r$ P* P& ?9 T( B
    {+ U8 k! d$ @6 G3 m' i
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    8 M+ E% j5 j' d1 m2 E5 f  Bline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    8 A! C! ^5 s, {! h" |line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    : [) a5 B8 r% T' U) H4 b' J}
    # m) n1 Z# L2 w; F9 O' S+ t}' d4 s& i9 m$ V& L" ^; w) M
    }
    ; `) Z( c  v+ d( S4 t& h  \4 aelse if(FLAG_TT==1)
    ) G9 }6 d# J5 s; _5 ?1 v2 S{% Z" ?2 L. [7 m- j2 @! n
    x=0,y=0;8 N8 ?$ j# v% W% Y
    for(i=0; i<num; i++)7 Z) k6 B% Z; W0 ]' I$ p
    {
    , H; L9 ^4 p7 @4 h" X, {1 p: Bt = (float)info[0];+ E) _6 I  Z! f: ~7 a/ H- O) L& c
    temp = (t/101)*180;
    % D& ]% O/ r1 cpos[0][0] = (10-num+i)*50+x+650;. l- D: {# \" b) {( K# [7 X: J" Y
    pos[0][1] = y+210-(int)temp;) L5 |& v+ Q3 |( U
    t = (float)info[1];
    6 ^% O  G" w5 Jtemp = (t/101)*180;
    9 w" c; |! k# h  |1 J9 b5 _pos[1][0] = (10-num+i)*50+x+650;' H! V0 }0 J4 {) S
    pos[1][1] = y+420-(int)temp;
    ( D0 [' T( D' W) e( O5 y( I4 a8 xt = (float)info[2];2 f) _; l2 l/ s) k
    temp = (float)(t/101)*180;( U; t/ V# j% b# f8 _1 z
    pos[2][0] = (10-num+i)*50+x+650;0 r+ P* y/ M# r, v
    pos[2][1] = y+630-(int)temp;
    1 Z4 }* Z. G2 O) V% o6 H}6 p) L8 Q' u0 I- z8 U
    clearrectangle(x,y,x+1200,y+650);
    : T% }- o! o% a7 R) r  e+ bsettextstyle(40, 20, _T("楷体"));
    7 P' ?9 p1 ]- _4 c: mouttextxy(x+50,y+50,"TT");
    . _) T) G/ T! Nouttextxy(x+280,y+20,"CPU");       //画柱状图
    ! ?! c% y5 L! F" K9 F' l  H8 g( Vouttextxy(x+285,y+20+200,"IO");
    : {- i8 J3 @! c6 o2 Q6 [" i  f: {outtextxy(x+250,y+20+400,"change");; z, s% h0 `+ ?* m5 k
    rectangle(x+270,y+65,x+330,y+215);
    / e' @/ n# \8 M8 ^1 e7 Y' Urectangle(x+270,y+265,x+330,y+415);
    & t/ H3 E* W$ z+ h, o) H: H7 z) rrectangle(x+270,y+465,x+330,y+615);4 o% i' T. D. _8 l" _4 o
    outtextxy(x+290,y+620,"TT");
    ( ~+ l1 i  [) p, Kt = (float)com;$ g$ q$ [# a4 w& ~' l8 g
    temp=(t/101)*150;
    ) ~% q; o2 Q. [fillrectangle(x+270,y+215-(int)temp,x+330,y+215);$ i) A8 K/ k3 l7 i! p* F& z& u
    t = (float)wai;. U2 u1 Y, z, m2 B5 Z( v/ Q, I& U
    temp=(t/101)*150;4 D$ ^+ F% v* y3 ~
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    7 E5 g8 M3 b8 U1 V, x9 [5 xt = (float)cha;
    " j: C/ s; o6 M0 s' Stemp=(t/101)*150;7 i7 k% H1 o9 R( @2 K, p+ ?
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);: O* X4 L3 ?/ \: x  t& i: P0 Y
    for(i=0; i<3; i++)   //画坐标   high=90,length=250) o, S' H2 z- v
    {
    1 z5 p; b" \8 \  N6 Q2 E8 Jline(x+650,y+210+210*i,x+1150,y+210+210*i);0 D7 P: A: C' T" l; h
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);3 i3 k1 J5 n( M  N* K
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);" y3 x$ f5 ?. `- ?# h! h

    ( \& ?8 o. Y+ `" h$ j! I, D, @line(x+650,y+210+210*i,x+650,y+20+210*i);! |! g, b4 K: a* H6 j+ u
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);4 q, y& B1 w9 z7 _3 j9 Q. Z5 F
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    ! x5 d! o9 {" q. i4 {. dfor(j=0;j<num-1;j++)
    & R# H# r) ?& g/ i; Q{
    8 T  z" {# v2 y* `1 \line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    . f0 n" N" z; R! M8 oline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);' k6 L1 ^# b1 A/ {# o
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    / |, ?; t: W: ?# {" C; g2 v}0 C1 I  N2 g# ~; D* M
    }3 s- u/ l7 f- B" y3 d6 [! b9 _
    }1 K6 ?6 B5 B2 p$ H
    9 L! A' w' z& w8 v- W

    " S7 O. Z% |( v* o+ j) xreturn 0;1 B' d$ Q; j6 O! c7 U5 b0 ?
    }
    ! x* f" B. s& F$ S6 Jint drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)
    - O+ ^: F! D% J2 Y- v{' R: j( V% Z$ w) K, C
    static int info[11][3],num=0;. l5 A+ |9 _' C9 x0 N- M4 {
    int i=0,j=0,pos[10][3][2];
    8 L$ |& Z- C3 k1 y5 S& {float temp,t;7 d3 s: o' j' a
    info[num][0] = com;! B" Y0 C' d% [3 g: [1 u
    info[num][1] = wai;
    - A* b5 T- t- D7 `. }: Ginfo[num++][2] = cha;$ ?  L: ?8 W: j  g& W+ |( o; S
    if(num>10)  //存储10个点
    * v: i) }& N, T1 \( `* k{
    1 F. b; P3 K9 E! Bfor(i=0 ;i<10;i++)* u, }+ f6 {7 m4 a) T0 R. z* u
    {% D$ i" V! I1 M! y9 _$ m% }* ]9 f
    info[0] = info[i+1][0];
    8 \! K) N; Z5 w) S& a1 Uinfo[1] = info[i+1][1];/ T4 M; j/ G4 p( q$ D1 ^
    info[2] = info[i+1][2];
    : F0 r- k0 s: R8 v3 t+ b}" c6 j; g" A1 M/ j6 ^; k- l
    num--;7 L. H8 \+ B6 {* e  [8 g3 q% ^1 ^
    }
    $ v* j! [& R- E5 @1 Nif(FLAG_show==0)
    " ?4 D# |" U- n5 h: Q/ rreturn 0;
    9 ?7 |% \5 c! v  K( nfor(i=0; i<num; i++)
    8 u  F+ ^- H- J- w{
    , y1 T& o; x% B5 }' B& a; }& mt = (float)info[0];( \9 N/ S# `& l! I4 Z5 \
    temp = (t/101)*90;
    , J" y  T0 f. [/ u$ zpos[0][0] = (10-num+i)*25+x+100;$ z( L" K( M, G4 L
    pos[0][1] = y+110-(int)temp;7 l3 O  K2 z; [2 T
    t = (float)info[1];/ D0 q0 H& q! b5 K, t- W
    temp = (t/101)*90;/ y& n9 }2 c& n1 k- }2 ^7 l
    pos[1][0] = (10-num+i)*25+x+100;
    ) d2 V$ M* A9 bpos[1][1] = y+210-(int)temp;
    & H  C1 J& F. N" @# wt = (float)info[2];7 D1 H6 E5 T! D+ H8 t
    temp = (float)(t/101)*90;/ _6 s* `& q* i, f: e) T6 n
    pos[2][0] = (10-num+i)*25+x+100;
    + P) E& D3 Y( K" Ppos[2][1] = y+310-(int)temp;
    * G& _) C2 _6 [" t( ~" [}
    " `9 N0 ^& {% {8 W' A+ c+ ?8 rif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    & o' p' e! m! m' g7 }% H: m{( b' J3 {! W+ `% \
    clearrectangle(x,y,x+400,y+315);) n2 b. Q. ~7 O" P1 v6 F( j' Y5 J
    settextstyle(20, 10, _T("楷体"));
    9 F! l& [& L* A. `' b: [rectangle(x,y,x+400,y+325);' S' S+ b/ y' _' ?
    outtextxy(x+40,y+10,"CPU");       //画柱状图! X$ |3 @, S8 x9 I, M8 z
    outtextxy(x+45,y+10+100,"IO");: ?- A2 M, i( f; n8 i8 Y  ]
    outtextxy(x+40-15,y+10+200,"change");
    $ v  K. g+ I( ^8 o0 Qrectangle(x+35,y+30,x+75,y+110);
    0 O- r7 t/ i8 arectangle(x+35,y+130,x+75,y+210);; m4 j5 D" L" s8 T6 N
    rectangle(x+35,y+230,x+75,y+310);
    " w$ I$ U# `: \: T) Wouttextxy(x+180,y+310,"PF");
    0 l! ~  ?# v' I2 m& Y( T1 bt = (float)com;
    ; {" _6 w- ]0 g( etemp=(t/101)*80;! ^& I( F4 W  q; ~% o; k& o2 b
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    ) q6 n6 u: }5 ]3 s7 et = (float)wai;2 w1 q: u1 h' U  o6 |2 Y
    temp=(t/101)*80;
    * _* [8 E% w6 L, ~" K4 C1 b0 Ufillrectangle(x+35,y+210-(int)temp,x+75,y+210);9 l  v0 @3 b6 f, s/ \
    t = (float)cha;
    : u8 M, w6 |) J" j/ p4 e3 ytemp=(t/101)*80;
    # _% m& g  v- G5 h2 C; sfillrectangle(x+35,y+310-(int)temp,x+75,y+310);4 E# {8 V: q7 i  U; L
    for(i=0; i<3; i++)   //画坐标   high=90,length=250* Z) p. k/ L9 c& z* ?( q
    {4 i6 g1 o9 G  H$ [6 M# y# g
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    / o4 p" m# M* i9 Z8 C- }4 dline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);- Q+ m; z: Z$ l8 l  H
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);6 s$ s/ ^/ a0 a: I- K8 G1 y" L
    , g( J0 i* D) b; s
    line(x+100,y+110+100*i,x+100,y+20+100*i);& V( w4 Y. D6 |
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    * ^0 _& M0 L9 W. Tline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);/ `0 R7 A1 G. \; Q
    for(j=0;j<num-1;j++)# b8 F2 R5 x0 R9 E5 H
    {
    , G  g* j. D% Jline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    / }" p+ W; O# y7 J- @line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);3 f! O+ E& m2 r; Q- _
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 4 n* J: d' o% d' l4 w
    }
    7 x3 B9 {0 a- n! E) Q7 ?}
    - r/ g7 W9 L7 m# B+ n}
    + _0 p8 U) @( l9 }' belse if(FLAG_PF==1)+ h/ i3 Y% x) X
    {0 ]; r6 X# Q  Z* I: q" H/ T
    x=0,y=0;
    : @+ M# E* {% K8 ofor(i=0; i<num; i++)( |( ~; k2 q( a
    {
    : R) }" M+ c: v1 c3 k( Dt = (float)info[0];
    0 A$ }# n3 l- O  ~: N' x6 n4 u  k! utemp = (t/101)*180;; q) B) d! U- I  g- ~  [
    pos[0][0] = (10-num+i)*50+x+650;
    2 n; v  a+ x0 U5 `# g# ~pos[0][1] = y+210-(int)temp;
    , X9 T9 r. K+ s) B& X+ rt = (float)info[1];9 [: N9 x2 F5 W/ ?' i5 K
    temp = (t/101)*180;
    ) I, m$ T; U8 R: z" H( k* mpos[1][0] = (10-num+i)*50+x+650;
    + A' d# Y& P/ s3 `' Wpos[1][1] = y+420-(int)temp;" o3 f* y  |. R# |: B* V/ c8 A9 ?
    t = (float)info[2];- d& n! t( F- X% S$ a
    temp = (float)(t/101)*180;
    ) B+ B/ u9 X4 ^  s  _+ q7 Xpos[2][0] = (10-num+i)*50+x+650;
    , ~7 L, ?) C, a$ C1 \; j2 p1 B0 jpos[2][1] = y+630-(int)temp;
    9 E! Q. t. M. r5 P}
    5 e2 n" @) Z/ r0 }' Pclearrectangle(x,y,x+1200,y+650);
    8 c) S' @/ G# p9 `1 o) \  m4 ^settextstyle(40, 20, _T("楷体"));8 }* Z6 V5 Q/ P: I7 f3 H1 Y
    outtextxy(x+50,y+50,"PF");
    2 Z; A1 E+ `1 Mouttextxy(x+280,y+20,"CPU");       //画柱状图3 k; @( _) a! q2 }6 B& h
    outtextxy(x+285,y+20+200,"IO");8 X( {3 b% \8 W3 W( d4 Z: \
    outtextxy(x+250,y+20+400,"change");
    8 f# i- v  U% |# _7 i, a0 v# G* Hrectangle(x+270,y+65,x+330,y+215);8 o" j2 ~  R! i# A+ i7 U3 u+ [; L
    rectangle(x+270,y+265,x+330,y+415);1 }1 I0 u" {) E: ^
    rectangle(x+270,y+465,x+330,y+615);% ^: e  D3 C  h3 P3 G0 _
    outtextxy(x+290,y+620,"TT");
    4 g; h- [6 R, rt = (float)com;; X" m" [7 ^3 T; M8 k# k
    temp=(t/101)*150;
    ; H, I1 D" }1 `2 J2 u3 yfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    * x9 t/ J: A4 [# `/ Q7 kt = (float)wai;$ A; E' `( o; J9 u: b7 h# c, J
    temp=(t/101)*150;
      m, |4 H$ T; ]) G) Lfillrectangle(x+270,y+415-(int)temp,x+330,y+415);- l% x2 z  F& C" @2 |* o
    t = (float)cha;
    : D5 f) H% ]4 X4 Dtemp=(t/101)*150;2 F) x! d6 S2 Y$ X
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
      J4 s9 m$ R0 m) Tfor(i=0; i<3; i++)   //画坐标   high=90,length=250, q1 f  ], a/ z3 h
    {6 D+ a1 x1 [; O' X
    line(x+650,y+210+210*i,x+1150,y+210+210*i);* g7 G7 J3 H6 [
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    " c' B. @& l1 ?3 J/ z* y. I$ Jline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    9 U+ F1 N& j) i* f$ }! `: [9 i% ^* d& {. Z. D% u
    line(x+650,y+210+210*i,x+650,y+20+210*i);3 P( P, r" J0 z; `& t) Q
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    8 z3 q7 C9 a! q; h4 M2 o5 M- qline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);/ |9 \5 @) D+ @, N9 `9 V( G! u1 M
    for(j=0;j<num-1;j++)
    , X) b+ l' n0 B/ C  j0 I{$ P7 c& B; G' F& o  ?
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);5 n3 A# r# m+ D9 V1 G
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);! A& l) e- s, p/ `+ x' O$ T/ b
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    $ m% F, b7 a# \& q}
    8 S( n4 F* z" m; h  K" ~}
    $ S$ F8 S+ e) [0 m8 N6 T! f  u4 H}
    * J9 H4 g1 e4 v) G5 O9 t. l% Vreturn 0;. @6 R* J; y) j$ e" S2 y8 }
    }
    % D* p: g7 v1 jint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)
    9 c8 t1 A9 d6 I, E0 _+ f  H{0 o- j5 c7 Z* J* }- g* j7 N
    static int info[11][3],num=0;- R( F2 d5 l0 Q
    int i=0,j=0,pos[10][3][2];  g* n/ O' I) e! |
    float temp,t;
    2 J" U4 U9 j5 Y4 I" Iinfo[num][0] = com;
      z7 S5 C) i' _$ {# O$ R; X1 ?# iinfo[num][1] = wai;% N" D0 [) b* m0 q7 {
    info[num++][2] = cha;* z6 }+ i  j4 t# A/ R
    if(num>10)  //存储10个点( w' L% _. F; t* R
    {. R1 Q7 g% I3 b. ~( G5 N
    for(i=0 ;i<10;i++)( e* A  e8 ^% ^+ n/ B
    {# x3 B* ?, m' n8 p4 ?
    info[0] = info[i+1][0];
    5 P2 Y9 {0 p+ f) y" V5 E6 Rinfo[1] = info[i+1][1];
    ( {6 p3 t. ~4 B, Finfo[2] = info[i+1][2];
    * X2 |# I! ?% y% p" O: z}0 P0 m$ V5 N, B
    num--;& q+ A" y5 J( p# R3 L8 P/ p
    }; k  p- _& _$ a+ U( v/ m  \* s- @/ Q% U7 R
    if(FLAG_show==0)- V' o9 s* c3 W; z" _( T' e
    return 0;" W. u! P% |7 {+ G; \9 B
    for(i=0; i<num; i++)
    6 K9 j- h' i; _{
    % l2 v/ W) u( l. m! y1 Dt = (float)info[0];9 p' ?$ H4 i% b0 V, C
    temp = (t/101)*90;
    * K, ?" r5 p; z9 D6 E6 zpos[0][0] = (10-num+i)*25+x+100;
    - p& v, O, H  ~- K  N3 Bpos[0][1] = y+110-(int)temp;
    2 ?8 f4 i" F! i& l/ c2 t  t+ E3 x7 nt = (float)info[1];4 K( ^% q$ a4 N9 p- h
    temp = (t/101)*90;
    ! R& N. ^7 i/ q0 a0 Mpos[1][0] = (10-num+i)*25+x+100;
    $ b4 p. f( U# k( o' k* {/ hpos[1][1] = y+210-(int)temp;
    & E6 f* W. _2 ~/ W, ]* Bt = (float)info[2];3 n: J% p( r) E, y% t+ r
    temp = (float)(t/101)*90;" U9 g; ?3 J5 o7 S& Q+ B5 T
    pos[2][0] = (10-num+i)*25+x+100;
    4 n% j- ^" r' u0 N1 u; ]. `1 Hpos[2][1] = y+310-(int)temp;
    3 n; m6 b1 k! b3 _: [- U' M8 y}4 T) ?( C7 ~4 R4 X7 b3 T
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)! j3 W' z+ T, A6 _/ E
    { % j% e3 `- |. s) F% `% \- J
    clearrectangle(x,y,x+400,y+315);
    2 h" Q) Y) `" v% msettextstyle(20, 10, _T("楷体"));& R- S7 f1 G% J% u$ }( {3 U
    rectangle(x,y,x+400,y+325);# e. N$ s7 x. R( f8 Q, \
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    3 z0 g: |: n4 a* s% \- n2 [outtextxy(x+45,y+10+100,"IO");4 Q8 f& I2 K* u7 [6 U! c2 z
    outtextxy(x+40-15,y+10+200,"change");
    6 z* W; Y0 l, |0 F% H4 j( Vrectangle(x+35,y+30,x+75,y+110);, f6 e5 l% f% S' w. {) R
    rectangle(x+35,y+130,x+75,y+210);
    2 o6 q9 z4 D5 ^% T% Z2 j) @% Arectangle(x+35,y+230,x+75,y+310);
    ! b1 x- s' Q' _! V" w0 Touttextxy(x+180,y+310,"SJF");  ^7 t. t, u8 b* k, W' O6 i
    t = (float)com;( y( }% q+ M4 I' Z# @  P
    temp=(t/101)*80;8 B: f" x, [0 P4 E  o: y; s  `  _
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    : X+ T7 B$ ~" d, Yt = (float)wai;
    4 t) t% r3 ]/ ~/ T3 Gtemp=(t/101)*80;
    7 w" w: l$ |# D2 ?0 Tfillrectangle(x+35,y+210-(int)temp,x+75,y+210);  {; s& m* f' t
    t = (float)cha;. p/ g  p, U% a6 [5 ~
    temp=(t/101)*80;) I8 p$ v/ B, d2 L# G3 Q
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);9 v! h9 I9 \- l9 o7 o2 ~
    for(i=0; i<3; i++)   //画坐标   high=90,length=2501 B6 ]( W7 b% G2 R2 }
    {- K; P4 G5 R% f, y) f! o- J  G! `
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    / p: \' _: K, [  a* @5 a! k$ \2 Qline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);0 ^0 {* V/ {3 @, X) j3 x9 W
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);$ |6 I/ s  G* L( y7 H( G+ G- ~

    # w8 ~; a+ C6 }0 o' W2 `! _line(x+100,y+110+100*i,x+100,y+20+100*i);
    ; U- y( Z- ^& W, [8 W. Gline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);3 M, t4 L7 R0 w; q
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);( B0 U4 b6 L# ~+ j
    for(j=0;j<num-1;j++)  c# l: N3 q& d* p. h0 a9 v- O" `- Q  ~
    {* N4 m- x8 L, N9 z) n
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    7 c- h: w% `# @; Y& I, c- h  Cline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);# h! N# r: g9 j
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ( f1 G) ?8 I6 s) o! s5 a' h3 D! }
    }% C6 }  ]% a& [0 Y. W6 ]
    }1 T) l5 A2 |3 [" ?" h9 s
    }
    2 a% e( @  i3 x3 k- \+ N: f0 kelse if(FLAG_SJF==1)+ a3 g! f7 u7 n7 `2 r+ m0 h! ]4 x
    {0 x% ]( B  Y: i% q
    x=0,y=0;
    : ^! d. L+ Z2 l+ qfor(i=0; i<num; i++)
      r0 }; |/ X! L1 T3 k  }{; A$ x2 b/ S$ n3 j  p
    t = (float)info[0];
    ; ]4 }" Z1 i3 M9 Htemp = (t/101)*180;
    " G6 L( o; [/ v; q5 r8 K$ ~pos[0][0] = (10-num+i)*50+x+650;$ A% b- u! o9 G, u, m" B5 S
    pos[0][1] = y+210-(int)temp;
    , q2 {( W8 U0 y3 L5 R1 et = (float)info[1];
    0 K9 E2 Q  x" S4 I' etemp = (t/101)*180;
    $ n6 `3 @3 y, o. T' s. v! Bpos[1][0] = (10-num+i)*50+x+650;& @# m9 c# w- s, P  u! y1 D
    pos[1][1] = y+420-(int)temp;
      X; P8 E3 l% O+ T4 |; e$ Ht = (float)info[2];
    4 I) M  x6 E: ]# P8 Mtemp = (float)(t/101)*180;
    ! y& m1 K, ~$ a( C8 npos[2][0] = (10-num+i)*50+x+650;+ P$ j5 P! S& U3 D- i2 w
    pos[2][1] = y+630-(int)temp;9 c4 a, `* ?: K/ Q- l
    }
    , N+ G$ v1 |4 G# ?( }* ?# H9 vclearrectangle(x,y,x+1200,y+650);
    6 N' `# n8 c2 @& q  k& ?. hsettextstyle(40, 20, _T("楷体"));+ O  W8 b0 O9 s, K8 D% \2 ~
    outtextxy(x+50,y+50,"SJF");
    1 d4 R" v. t6 H- B0 houttextxy(x+280,y+20,"CPU");       //画柱状图
    9 o1 ^4 P- b5 h# Aouttextxy(x+285,y+20+200,"IO");
    ! z, J$ i- @( x! f3 Wouttextxy(x+250,y+20+400,"change");) ^1 r' Z" Y: `8 Z2 N
    rectangle(x+270,y+65,x+330,y+215);
    5 f$ H# D5 k6 }+ K5 n% g6 e. [rectangle(x+270,y+265,x+330,y+415);+ y' ~0 _6 q7 a8 W; R, W
    rectangle(x+270,y+465,x+330,y+615);
    0 b9 L" F! M: d  p! S! i$ V0 |outtextxy(x+290,y+620,"TT");
    1 ~, @* N: F, D! L9 J8 u+ St = (float)com;
    4 X8 C0 z- P6 R% Gtemp=(t/101)*150;0 a' J) Y7 r- B9 K! j# N5 W0 N
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    * n. s8 N4 k; h, v* m" Xt = (float)wai;
    + z4 c7 x: I7 m, h$ Qtemp=(t/101)*150;
    " \2 j* n  a4 m" m, O+ [6 A9 x9 wfillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ) @  A  Q% Z$ U) Jt = (float)cha;! X; F* j: U( o% D3 j+ v0 a: u) T
    temp=(t/101)*150;# c( k: H7 x& l% K
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    ! Y7 g4 V9 F, ?. M' v. Sfor(i=0; i<3; i++)   //画坐标   high=90,length=2508 }! q- Z2 v1 ^% e
    {
    " W9 I1 A! G7 \- w( Yline(x+650,y+210+210*i,x+1150,y+210+210*i);) Z& B; r: c) k( x- b" F
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
      Z/ N% H& p9 J3 pline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    : A+ M. Z/ |* |) w' l$ W+ J3 |; l! m+ H0 S
    line(x+650,y+210+210*i,x+650,y+20+210*i);8 `1 K6 p; Y+ m7 P
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);, @$ ~( v9 ~& K
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    5 ~. u' b' r0 M) Afor(j=0;j<num-1;j++)
    8 v& d. ~9 O1 S{2 ?& S* v6 L. r; c! _
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    7 P0 f2 _) S2 ?. ^, Z, w0 P; rline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ! c  Y. [3 [; J0 a3 aline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ) C3 y% |' R  }  V( v
    }
    , E! O1 f4 }  _+ T0 ?}
    7 b7 {/ T3 K3 y* y) _$ |}9 b& f( V6 K; d6 v" {! l1 D# r
    return 0;7 c4 m$ t( P% `
    }: q3 R8 V/ B* [" m: T" I" {
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)5 `, I3 }- m: V
    {+ Z6 ^  {2 h4 L- n. D
    static int compute=0,waitio=0,change=0;
    / k6 S. |8 E1 ^% c/ G& ^+ ?% Dstatic int computeLast=0,waitioLast=0,changeLast=0;
    ( f. y8 R. ]8 q* N: r7 `) Qint i=0;3 h% y, Z0 H# c+ R
    if(draw==1)6 \# C' o1 u: Y# K6 U  z* f. x
    {
    ' `) i5 G: K' E8 s! Z/ g//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);5 Q5 q5 p% X! d0 p/ \; z2 K
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    # Q, G2 k' r3 M; R) y7 a7 D7 pcomputeLast=compute;) l* W8 s* p1 [9 E! i
    waitioLast=waitio;$ t& I2 A4 ~. p; w
    changeLast=change;  g( M4 O' }0 _: k' n' j! D" N4 T
    }6 H  S" t0 g" S# p  G
    if((* memory).p[0].flag==ready)
    . n4 D9 L- S6 L. l" E. c! B(* memory).p[0].flag=computing;
    ' ^( _8 d) D# T+ `. gif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)8 I% k7 `7 V; `. e6 ~0 ^9 Y: K
    {
    & V9 t+ O' _6 s! W) z7 r, zi=(*memory).p[0].computeNum;. M% v! _1 K% O2 L
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed; Q+ \' r: D7 ^3 S- Z. V
    {: K6 g# K$ r! i
    (*memory).p[0].flag=IO_waiting;
    5 N' d$ c( V4 z0 H4 s3 X$ t(*memory).p[0].computeNum--;3 \8 O/ L7 K" G  @
    change += exchange_IO_Compute;  y4 }+ p7 [& J% F1 n$ I
    compute++;9 b* h, k- _1 o) r  g, O+ ^% D! S9 ~# j
    }, X  i  @; J+ ]  }( A- ^
    else
    / a( ]+ k* Q5 V4 C{
    8 A! t. y! i. j% w; t, b4 Gcompute++;, w7 m. R' ?3 x$ i0 J8 L# _
    }: Y) s! {8 ^5 W, Z( \5 e
    }
    , X( P) Y1 p) [, P# n) U! Melse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)5 Y1 i% X! G* p" N) u2 b7 [/ z
    {
    / I& |4 s$ W" [" a6 U/ z+ V3 e1 o
    i=(*memory).p[0].ioNum;
    / \% ?3 u+ l# l) F2 kif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed5 A6 N# H5 Z. ^6 ~, |9 z0 g
    {
    8 C, `/ K/ @8 N) p, L(*memory).p[0].flag=computing;6 ~5 j8 ~# c& |
    (*memory).p[0].ioNum--;: I! d+ ]3 O5 ^$ {
    change += exchange_IO_Compute;& h1 K2 k% X; p3 Q/ x/ |
    waitio++;
    " e! B% U# @% |0 v3 i}0 k) L$ s$ c- Q; P# P
    else* ^: W) z$ ]" I
    {
    4 U' h; c1 n! l9 o. ]2 {waitio++;
    5 I, A8 {* E1 I3 d4 k}
    & k6 W( c% \$ t/ g- ~}  u, ~& }2 j; l8 D
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)4 m9 s3 N  [0 H" w# f( G* B: I
    {
    0 @* d- o1 ~+ ~3 Y6 G(* memory).p[0].flag=IO_waiting;
    2 T  H$ {1 K" f) h2 N# [% Gchange += exchange_IO_Compute;' s# G5 d. q8 W7 O. @9 g/ A
    }
    ! g$ u3 r! ~$ G" f6 lelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)5 M, G, B# T4 f6 n! l
    {9 U! j8 o: k" ]$ u/ O, H8 o- J
    (* memory).p[0].flag=computing;- x' j6 f8 l- C
    change += exchange_IO_Compute;
    & u, I' P0 u9 d0 m$ [; Y}! P4 j* h- k( O- e9 \
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    3 ?8 x' z1 `; \5 I5 P5 k" @{
    % U3 Y3 I+ H/ X$ @7 ]. Z(*save) = (PCI*)malloc(sizeof(PCI));
    6 F0 _0 ?" P: ~% U(*save)->next = NULL;
    - U: R, I' Z5 h8 P5 `3 }  H(*save)->processID = (*memory).p[0].processID;
    & ]; ]' q/ ?  ^6 o, _  e( x(*save)->comeingTime = (*memory).p[0].produceTime;
    2 ]& d( P7 U8 l2 J& r: f9 _& @6 s(*save)->askMemory = (*memory).p[0].askMemory;
    8 n4 R! E4 v/ {' D9 y( c(*save)->compute = compute;
    6 H  x8 o' {7 ?% k, V# j7 t" u(*save)->waitio = waitio;
    & l9 k7 Y7 l$ y  `(*save)->exchange = change;2 s. f$ o5 G, t) v+ I1 Y% z
    (*save)->completedTime = systemClock;
    $ K/ c! K3 }2 F1 u$ E! d0 \) d2 b(*save)->runningTime = (*memory).p[0].runningTime;; h: ?# ?$ X  F  W/ F( n
    *spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
    . c9 d2 q* r1 q0 |3 Scompute=waitio=change=0;' k" r+ Q" g6 J2 k9 y: f  o( Z
    computeLast=waitioLast=changeLast=0;" ~. k. ^  c8 k5 [* R$ C1 F# S
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);
    , D8 z4 |4 _7 B) w0 Lchange += exchange_process;8 r3 k; c' s  |) v, M& }2 q& n. E
    return task_completed;
    3 J0 @0 Y) d- G& ^$ `' D2 ]}
    9 b' B* _: j$ eelse" Q1 K) I2 q" V+ n% C
    return task_not_completed;
    , p  I+ x9 s7 [9 B  q0 @; j9 q5 I}7 C2 E& J  B$ v7 o/ V
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch): v+ c8 h5 E% }% [( ]# }
    {5 e$ ]" `- e3 w
    static int waitTime[initProcessNum],i=0,j=0;! v! u- f0 r" U4 b. K
    static double HR_ratio[initProcessNum];/ M0 n" N  ^0 ?2 h3 M
    if(flag==0)                    //初始化数组# y  G$ _" P  S, a& \7 W% R
    {# X( K1 @# J$ E9 i
    for(i=0; i<initProcessNum; i++)2 f9 K- K# e: d! a7 \* e
    {
    4 h6 O9 h' S% C/ {; LwaitTime=0;
    $ U8 z8 x' \. x* iHR_ratio=1;1 f9 c( v' Q8 x, ]7 h- c
    }
    / w) `8 \6 D6 o5 I% t' N}
    % g# W/ b5 K3 J. Ofor(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比, |$ X) P  p/ c* p. ]- c, M2 h4 Z
    {
    , ^  F: \. I* t; xwaitTime++;" o4 c" |. M$ q. L& c  n
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);
    ; b3 S. F  i" Z$ E) fif(HR_ratio > HR_ratio[j])5 ]' }7 W7 e2 T4 L8 s. D
    j = i;- t' ?' W# U2 c  ?$ j
    }
    3 k3 G0 _3 P' \7 Q/ `6 z1 lif(dispatch==1)                    //需要调度一个进程到内存中执行/ N9 n( y8 P& |* R' w
    {
    , p/ F! F; H$ Dif((*storage).p[j].askMemory < *spareMemory)
    . f4 U' Z0 o% ~: p* I{
    1 f& {3 l* K5 \4 e' G. {(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    $ T) S( B0 x5 u6 h7 S2 p1 e: e(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;7 |' t( h3 s. r5 c  ]5 H
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;
    6 h/ f7 j+ J. u' d% P. D) P(*memory).p[0].ioNum = (*storage).p[j].ioNum;# |0 S& V0 s) \9 i/ l: {) n
    (*memory).p[0].processID = (*storage).p[j].processID;1 ?7 R7 i! A6 j; V0 H+ f! Q1 ^6 t: {
    (*memory).p[0].flag = (*storage).p[j].flag;% j1 Z* M/ T8 k* g% ~
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    ; b% h. X8 ~: i' z3 R1 J& |(*memory).p[0].computeTime = (*storage).p[j].computeTime;* b; @( \9 u# V( O; c/ l, A
    (*memory).p[0].runningTime = systemClock;
    : }$ J2 \$ W0 h: U) L(*memory).p[0].produceTime = (*storage).p[j].produceTime;' ^2 A! ^6 k* y) l& i/ B9 |
    for(i=0; i<(*memory).p[0].ioNum; i++)) ]( ~" ^6 n! h5 I  s
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;* {/ H/ q1 ?8 F+ H
    for(i=0; i<(*memory).p[0].computeNum; i++)$ Z* X. I; y$ c3 ]+ }/ ~
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    : X3 n6 @' j3 {(*memory).proNum=1;+ a! Z  P. ], [1 y$ v
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    / m# }2 I6 P$ X4 z! z7 U8 x, oproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    7 O2 A3 Z3 J) S* ^6 d(*storage).p[j].produceTime = systemClock;
      A3 U% i, W) }3 E& F% i6 ZMAX_COMING_TIME = (*storage).p[j].comeingTime;: ^5 I4 V4 W7 O1 C+ n" Z0 g, t
    waitTime[j] = 0;
    : L* }3 H" ~3 A8 A4 yHR_ratio[j] = 1;. N" e: I/ y! q2 g7 W) A; g
    }
    8 l/ x* {6 I/ \+ O+ Delse
    9 T' m/ k8 X: @  `0 H{
    . ?3 i0 {% W6 a1 p+ m$ H; O- ~printf("A process ask for a memory overed the system capacity\n ");$ T- E5 @. G1 ~& f! f+ z
    exit(1);/ u3 e  j) l1 K( i) @/ }
    }! ]" l5 _1 V1 }6 q
    }6 Y3 o/ [9 E: J5 K
    return 0;* a" W; k  G3 o+ I5 \" S7 v
    }5 Y0 [* @: w6 D0 `5 |7 K7 u
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)1 y3 G0 ~3 G. X& x, Q  e
    {
    2 E# ?! d/ Q7 L# |  k7 C5 d. `8 Pstatic int compute=0,waitio=0,change=0;" f3 i- s* N# |
    static int computeLast=0,waitioLast=0,changeLast=0;
    ; }' b# t5 ^" U: P" Wint i=0;
    0 f0 n% d* u2 C) U& p5 s, R8 Bif(draw==1)0 E' _& f% D) J6 `) N4 c% w) o  G3 R
    {
    1 \" _# ?! i2 x( t; H% |9 \//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    + {- K3 g" U' L+ [1 |drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);5 k4 i. [. p: G

    ! I. |* x' W8 F6 H( H; ?
    " k1 V3 Z- O7 H) R& _5 b! BcomputeLast=compute;) R: p' l" ~  d5 b8 T: d
    waitioLast=waitio;
    * A2 p+ M9 h; k& a8 kchangeLast=change;
    / U/ [6 {" V$ p6 I: f* h5 m! J}# E" L# }& i! \( K9 t
    if((* memory).p[0].flag==ready)& m# O8 x6 C' i1 f  m0 I, X
    (* memory).p[0].flag=computing;
    2 {' T' \) j7 j7 L% Y1 Iif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    + a2 y0 H4 L0 }$ ~# u/ [( B{2 j7 j# f) E, j5 g8 W5 @
    i=(*memory).p[0].computeNum;
    5 H$ o6 g( Y3 V; G  R2 \if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed; A4 v* N, O% O6 g& k# C8 I
    {! a9 H/ m  {/ [8 G8 W9 G+ X& l1 v& T
    (*memory).p[0].flag=IO_waiting;$ V- t9 W! R# g7 h7 ?
    (*memory).p[0].computeNum--;
    * e7 N: c5 A8 K7 n/ q2 v% F) Bchange += exchange_IO_Compute;
    , l; U' l2 f/ u$ ^1 O6 `compute++;, G! I1 r3 \* ?* z: u8 W  Z7 d
    }9 s2 ]9 z- u' E0 ]
    else
    9 S% R5 J2 V9 G0 t5 l9 T6 g{
      K+ S' S7 d: }# O! Fcompute++;1 P( ?  G5 \6 u" P- i; X
    }; e: r! g  J- r. l6 n
    }
    ' {$ Y& U9 C2 A) Z; W% N# q/ j4 Jelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    : z0 F4 Q" ^% r- }6 T{. e' L/ \: L& v3 }: ~0 v$ n8 v

      D+ V2 j8 V( Ti=(*memory).p[0].ioNum;
    . N% a% S/ _. t3 g/ ^! Tif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    ( p7 z, Y$ X( ~* x& L5 e{' k1 R0 o6 x2 m
    (*memory).p[0].flag=computing;: @0 L/ A% Q( f7 D1 ~1 s
    (*memory).p[0].ioNum--;
    / M2 n# m  |, n2 R: Y. pchange += exchange_IO_Compute;
    $ e2 y/ ]1 W$ A8 b- q2 k% kwaitio++;
    8 G9 r% x3 d- }1 H# w}' W$ U) I2 v& o3 y( o
    else
    $ T0 s6 W% L) W0 S6 S$ Z9 p# n{' j4 m  g$ e9 o9 z9 L  Z" g
    waitio++;" f1 N% p- z' v$ V) o
    }
    2 _. E7 C+ [# S2 ~8 ~6 H}4 q- }* ^+ O. f# Q  S
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)) ?4 n& d9 }" u
    {
    9 X% N4 W  ?9 b# P7 [(* memory).p[0].flag=IO_waiting;# {* }; \! q$ K* n+ {
    change += exchange_IO_Compute;
    ' q' q7 T4 R' h7 x: n}2 Z# E" R; f' N! W$ l" D1 o
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    / P8 P" W3 c2 v( @/ C{; N: f& I+ v# B4 k6 R
    (* memory).p[0].flag=computing;2 r$ q2 X' y& g. l7 }
    change += exchange_IO_Compute;+ G+ n6 _# C" k- v9 s* ?3 ^' d
    }
    0 t7 I3 }% J) t2 Zif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    5 r6 }; l, b0 R1 l4 S$ T{
    ! j/ A: C% O* C+ b2 J(*save) = (PCI*)malloc(sizeof(PCI));
    4 E, }) N- j1 v0 h1 L0 c2 X(*save)->next = NULL;# S6 F0 W2 ^) A, q, u1 {! m* {3 z
    (*save)->processID = (*memory).p[0].processID;- o9 Z$ B1 t, K7 e
    (*save)->comeingTime = (*memory).p[0].produceTime;( v6 z" X: X( f/ Y1 S  Z( S
    (*save)->askMemory = (*memory).p[0].askMemory;
    ) S/ U# ?& t0 W  Q; v5 R(*save)->compute = compute;# k; t- W4 @1 Z% M. r( Z7 v& [) E
    (*save)->waitio = waitio;' p/ k: p7 l2 t, B( E) w* }
    (*save)->exchange = change;
    4 j+ p+ v! D( B* b$ B& K$ m. c(*save)->completedTime = systemClock;
    ! R$ P9 a- g3 t(*save)->runningTime = (*memory).p[0].runningTime;
    $ }" i- |/ }2 }+ O8 Z3 v*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;& q7 ]9 H- k5 r  A1 w
    compute=waitio=change=0;
    7 ?- c& w' ~, h' H7 M* Y) |computeLast=waitioLast=changeLast=0;8 C: x3 H0 w) n: N
    Priority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));% l7 M/ a# }5 G5 E
    change += exchange_process;
    2 I$ F8 \: n, {) p# T+ wreturn task_completed;
    . B+ e: l. |% L* L8 F}" b9 g% v' S# _8 B) ?% Y
    else! m7 i  B' t/ e3 }9 I
    return task_not_completed;# a) \4 x3 b5 g; G" J/ b2 d
    }
    . o- V% `% ]2 }3 Uint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)
    6 t: u3 m3 g# V( ^! G{# X- {  ^4 O( Z0 F; e
    int priorityNum[initProcessNum],i=0,j=0;. }: R$ ^" H! r0 v  c
    double temp=0;: l. u# T+ l) @8 `! w( |
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process5 E8 X0 P* F* C# q5 L3 n& K
    {
    " n+ v! E; ]. r" @) K8 f9 Z' ?( rtemp = (*storage).p.computeTime/(*storage).p.ioTime;
    5 p' ?+ o8 Q* V9 |+ x$ \) Mif(temp > 0.8)8 x+ k. I* E/ n0 |) y8 e
    priorityNum = 6;
    ! L3 R" H5 \/ }8 }# f- Eelse if(temp > 0.7)+ P+ t' b) @; q8 I
    priorityNum = 5;
    , [$ \# t. c3 q9 {else if(temp > 0.6); L/ T& c7 X" E( W+ z9 D
    priorityNum = 4;: O4 m& x: S4 i
    else if(temp > 0.5)9 B5 X( E) j& e: M: I* Q0 [9 m2 \: V
    priorityNum = 3;
    6 X# L4 B: S) F" J4 ^! L2 A! aelse if(temp > 0.4)
    7 m. y" @7 |8 f5 ?5 i( @  lpriorityNum = 2;
    4 \, U; x9 R8 Z; pelse
    ; E3 c5 ^% ?) V+ T0 Q/ zpriorityNum = 1;
    ' y+ M# t2 w3 h' {; |if(priorityNum[j] < priorityNum)
    & c* l) S2 s! Y% c" s! _8 zj = i;. [5 ~4 Q. B' Z2 I0 e, ~' V! A
    }6 S$ T+ p" [$ N$ @! E
    if((*storage).p[j].askMemory < *spareMemory)( H6 T; c/ ^! ^# F" a4 E
    {
    8 s9 G3 m  \  p(*memory).p[0].askMemory = (*storage).p[j].askMemory;  e, k5 T( |0 p) j3 F8 i, k
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;" {5 v8 M# }3 n9 N
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;. s8 V' h* b7 s. T- `0 B
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    # G: j- y# L) k3 i  q) @(*memory).p[0].processID = (*storage).p[j].processID;
    ' z% \5 E- p$ u(*memory).p[0].flag = (*storage).p[j].flag;6 {8 ?* }% O, Q" f/ e
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    , O7 V5 m1 I" S* Z  x(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    # D3 D; J# Y* S, @+ _+ j, s6 Z0 M(*memory).p[0].runningTime = systemClock;
    ) r/ e- j; m4 S2 j$ G3 `(*memory).p[0].produceTime = (*storage).p[j].produceTime;5 J; n: w# o/ X: ]# {, a
    for(i=0; i<(*memory).p[0].ioNum; i++)
    6 J  ?5 g  [9 v* P$ T5 H/ M- s- z(*memory).p[0].ioClock = (*storage).p[j].ioClock;& Y1 t4 `+ M5 {* S
    for(i=0; i<(*memory).p[0].computeNum; i++)1 `( s3 T4 G% T1 L( O- H. v# r0 D" [2 x9 W, P
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    " b" X# }; c4 l1 `) G/ r- K(*memory).proNum=1;3 c! E6 o) C, H6 u7 y8 z& C
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;6 y. r/ q3 W4 n' o1 Q% R
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程  H' |% |" S/ ]0 T3 `9 }7 s& A7 L
    MAX_COMING_TIME = (*storage).p[j].comeingTime;
    ) P' B  e& X9 W# [. w6 R7 p6 ^}
      l" B! H1 ^2 J# b8 aelse
    - \) {! a1 s: M6 f! j1 L/ J+ Q{# E! G0 \/ `! s
    printf("A process ask for a memory overed the system capacity\n ");, X  s/ Y* E2 a' b, g( H
    exit(1);
    ! n9 Z8 M! y( E+ W4 \7 m}
    4 p  R8 J; E% T' y. yreturn 0;
    8 K) a3 \+ s: Q. ~$ R8 g. B7 K; [}
    & V& c) V' c1 w# ?8 R) f6 F! \int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    9 D) V9 s, A1 t; s1 z, {7 l4 W: D, U& [, ]{& W3 u& J: C! ~) G7 s: E/ D5 h
    static int compute=0,waitio=0,change=0;
    8 i: [% e$ p3 N4 I" R. F5 `0 vstatic int computeLast=0,waitioLast=0,changeLast=0;
    * @; Q% \4 J- qint i=0;
    # p3 r! F+ L. j5 H1 j) P. h: Hif(draw==1)
    # L% R9 J# n9 d  V9 X* E) {{, \" K/ P. M$ o
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);, [; i% f/ \" w' {- f
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);# n- B2 @; G4 T( w; ^
    * [% q3 G0 b+ \( N

    ' E1 R% v9 l) @( f! P" EcomputeLast=compute;
    2 ~1 ^8 }9 p& n# d, n! z+ FwaitioLast=waitio;, f$ |3 D0 _: [* J7 M0 m! d
    changeLast=change;
    . y$ C+ L* b  V* g}! ?3 N/ U' x0 D
    if((* memory).p[0].flag==ready)0 u& C! o% M2 L5 R8 H2 f
    (* memory).p[0].flag=computing;! v2 _) |3 _- ]+ K
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    1 m2 e- d  s( i3 y# ~* Q! D{
    5 @+ }) P: k, o. Qi=(*memory).p[0].computeNum;0 ^" T" r5 P  G: g
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    $ [  P$ T  u6 |$ ~5 S{" `% ~2 n( g) G/ {9 ]
    (*memory).p[0].flag=IO_waiting;
    6 q2 O$ ~% ~; L) R  T  U5 M5 g/ u(*memory).p[0].computeNum--;
    ( s5 P$ ^- U9 K5 n( N9 q5 j* o1 z; kchange += exchange_IO_Compute;1 Y8 I. k" ~/ k( z. T5 g
    compute++;
    % \! ?, m& ]# }& h2 U* A6 e" A( l}0 ~$ l2 R, P4 B6 w  \
    else% N& U, f2 Z5 h1 e: H/ {1 C
    {
    0 ]2 C( p7 c  p' ~+ {compute++;
    ) B, @3 H9 m- ^: h}
    $ F) k& X* T9 u}5 ?6 A2 h* p/ X4 C' K  Y
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)( z2 R/ h/ v, |) N* [6 c
    {# G6 N1 z9 _. |* n

    # G6 |- g' e. T9 F: ~i=(*memory).p[0].ioNum;, k" p# c/ U- x4 d) e, V! _
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed9 v& ~* R0 x- l1 _7 g' @& Y
    {( G% T  a1 i/ N8 s  @
    (*memory).p[0].flag=computing;
    ) Y) T* n9 I$ L  v9 |(*memory).p[0].ioNum--;
    : t6 x1 S# d1 x. g+ B' \- ~change += exchange_IO_Compute;. I( D. ]+ h. b
    waitio++;
    ) k7 X* P% t: I/ n}. a6 a- j" ~$ q. O, T3 W
    else
    ( ]3 d$ {7 ?( _* x{- s) w9 _: ?7 h5 z3 _. i7 |0 o
    waitio++;
    5 Z" l; Z. Q/ t1 t1 X9 ?. d# ?6 w}
    7 y8 E3 U8 f* S0 E/ d. U6 ^/ E}
    & I, W  V0 ^$ b! Zelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing): V7 d9 |$ G3 J& Y. _8 `, C4 i
    {0 z+ _* _$ V$ |, x7 @
    (* memory).p[0].flag=IO_waiting;8 N3 K: j. V' G' L. X% O
    change += exchange_IO_Compute;; q# r, W4 ]! b& Q4 [* X
    }8 L: V; w' Q( Z0 N2 n) g
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    ! y0 `4 \2 \7 A( A{
    8 `# i' A9 h# y: v/ \/ U(* memory).p[0].flag=computing;
    4 a; }1 R" n. B! ochange += exchange_IO_Compute;( \+ v0 ^1 Q. C" A8 O! }- \" ^
    }
    % W+ _+ S# v2 a! B" M5 cif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成5 c8 T3 m9 [4 }% j4 p+ Y# K) c
    {
    9 J7 y" _4 `, p7 x7 i(*save) = (PCI*)malloc(sizeof(PCI));6 X5 s/ ]8 x/ _
    (*save)->next = NULL;
    % S5 M) v2 G0 V, v! K(*save)->processID = (*memory).p[0].processID;
    " h; j' a+ Y, n/ Q(*save)->comeingTime = (*memory).p[0].produceTime;3 T' i/ ^, L  U
    (*save)->askMemory = (*memory).p[0].askMemory;7 K& y: l, b. I$ i% B3 Q0 I- [
    (*save)->compute = compute;/ ^; x3 N; m# N  |2 T
    (*save)->waitio = waitio;
    / \" W6 D$ o: ^# @(*save)->exchange = change;' P' ^  p- c" |8 E
    (*save)->completedTime = systemClock;; g/ l# d% s7 Z6 s+ u# x
    (*save)->runningTime = (*memory).p[0].runningTime;; [, \* Z- K$ f/ g( w& }% F! B. D
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;
      }) `; Z) H) `- V5 l: a2 ncompute=waitio=change=0;
    0 F- X7 M- C! ~computeLast=waitioLast=changeLast=0;* \1 ?5 `0 M1 p7 t1 ?  T
    SJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    . l, G( z( x8 w3 u, _change += exchange_process;6 T! M' _! J5 b8 R# a0 D- |
    return task_completed;
    6 N7 A8 d& P5 M4 p) ?}! n4 j9 ~4 j: k, ^) F% A
    else
    8 b0 c* r: ?" }& G# ]: b2 u2 ^return task_not_completed;
    9 t$ g' [- Z6 K; K) [}
    # R$ M% `4 {) S6 cint SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)* j5 w9 E: V' E: l3 F% Q% x
    {
    & m9 q" o- p2 D8 Zint i=0,j=0;
    ) C2 T8 m* Y$ a/ n% tfor(i=1; i<(*storage).proNum; i++)
    & a( T( o# I9 k* W5 g* B* D9 O1 d' Z{% `9 K  g9 O$ z$ E$ w1 A4 |! C
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))
    9 k+ A: I; a6 Z6 H8 v' h. ^4 cj=i;* Z2 |& t, [  I- |
    }0 c, i6 }- b# P1 o  i  ~# K1 {+ [
    if((*storage).p[j].askMemory > *spareMemory)
      x1 {2 ]) }, X3 m{) e# d% L9 h- o! P/ ~
    printf("The memory asked is overflowed than the system memory.\n");2 o2 }6 E0 ]# s- }0 g
    exit(0);
    ! z$ ]  U* P9 s7 `6 w1 y; g}6 _7 u' |2 _7 d
    else' ]5 T& t1 h( |; v& A( o
    {
    % a# H2 E  i; g' }! o(*memory).p[0].askMemory = (*storage).p[j].askMemory;  Z) d/ @$ P* u4 k& r6 }6 r6 T
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;# K6 `2 R' d5 i" A3 h* n% I
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;
    : X8 j% ]9 @. [" \(*memory).p[0].ioNum = (*storage).p[j].ioNum;
    5 ~+ f/ ]' e1 S/ ~$ {( m6 o: X8 s(*memory).p[0].processID = (*storage).p[j].processID;
    3 \( j# W$ D' E" `' F0 D(*memory).p[0].flag = (*storage).p[j].flag;
    ; E* C+ T8 _( W0 T! a9 A(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    5 J& s8 f" {4 f+ b% x(*memory).p[0].computeTime = (*storage).p[j].computeTime;6 y0 ]3 @+ R) `# Z
    (*memory).p[0].runningTime = systemClock;
    ; Q* ]: x2 [2 ?8 g$ o' ]  g2 d(*memory).p[0].produceTime = (*storage).p[j].produceTime;
    : X' r! M& j' nfor(i=0; i<(*memory).p[0].ioNum; i++)* {5 }4 u! q- J5 ~, R
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;& S8 A1 ~- j6 |! R- x* N3 ^7 h& _
    for(i=0; i<(*memory).p[0].computeNum; i++)
    ) G' I! P* G. V0 C4 H(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    4 v# F4 ]6 `/ a(*memory).proNum=1;6 D$ |3 ]6 l$ T/ k/ ~( y5 `5 u
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    4 H) L, B) C! R1 E; |produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    6 N; {( j) t8 V- KMAX_COMING_TIME = (*storage).p[j].comeingTime;
    , \" ?% }! Q8 ~8 S) M/ u}
    5 S) @2 L& o4 j3 ]: c/ x/ |. Areturn 0;" Q! H! k0 Y5 ]3 S) l: d6 V
    }
    8 b; M- b! B2 Y- x6 |5 Kint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    8 T' y) ]( O6 M% `8 Z{$ T0 e$ e1 ~* P  y( ~4 D
    static int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    3 w4 d" U  E, g0 l+ vstatic int computeLast=0,waitioLast=0,changeLast=0;
    4 {8 ?: |/ Q. y2 I2 gint i=0,j=0,k=0;
    8 A4 R4 m" ^% E, r0 P  g* @if((*memory).proNum<=0)
    6 _/ b4 X- }9 G' G+ u$ D! z# GTimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
    * j5 B* x6 ?5 p% k; k7 N: F! Wif(draw==1)* {* Z, O0 a/ D3 ~0 ^
    {, G, @: c" p% o# x9 w: n; z9 }
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);) r& Q* w4 U/ ~/ e
    drawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    0 a( ~& x. i, ?% ?( }! Y8 A% e5 N
    $ _# y" x2 m8 l. y) L, f, c0 B. `& r% X6 J  f  `& T
    computeLast=compute;! G4 w/ f* O& R
    waitioLast=waitio;- ?, c( f$ `2 C4 d! K* g3 T+ g( b
    changeLast=change;
    7 p: I2 @; F. _. Z5 ]. c- T}
      x' c# \& `: F+ Z8 C5 X7 V9 Nif(poi>=(* memory).proNum)- }1 j: T  I2 W* `5 {
    poi = 0;5 ]) _0 }# K3 |- \
    if((* memory).p[poi].flag==ready)
    : j' N2 B) o% z5 W$ Z$ M(* memory).p[poi].flag=computing;8 S1 w9 D" n! h" w3 v, `
    if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    4 @- e5 T0 r3 D7 E' v& t& e: `{( |- R. p( \6 d
    i=(*memory).p[poi].computeNum;
    ( I, H( k3 e2 {( s: E- Mif(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed$ Q* O- ~; q/ P; e& e  P
    {  n* q& b. a" K$ V+ z7 K( j& J
    (*memory).p[poi].flag=IO_waiting;
    , C# p8 ?) Z- s" Y* I' f7 D(*memory).p[poi].computeNum--;" b2 ^) P, g3 f9 F% y
    change += exchange_IO_Compute;
    0 g" `3 M* R) v6 Y+ P" S+ y. J% Mcompute++;
    / [) G' |- ^1 i8 p+ J}
    4 Z( B7 R' F$ _: B7 w7 E% gelse6 @* y- y' Q1 d
    {) v! z3 H. ^  R7 ?3 c( d, O
    compute++;+ R/ v0 P. h" M- s0 W  {" Q: n
    }
    0 L4 }: y" b% `! K& S( e}, n7 c5 z1 u% z4 P' t  e6 d1 t
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)7 S& X  a, F9 e( w: d" r$ y$ G
    {  A+ \3 E8 u/ f, n

    ! w: y; i5 _0 _: ^i=(*memory).p[poi].ioNum;" k$ j6 ?! h* X9 z: Q3 J3 ~# R
    if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    4 t( W4 l2 a* c! O{
    # d  g& Q. t. ^# z- N+ O(*memory).p[poi].flag=computing;
    0 L( r# c5 d/ O( s, B(*memory).p[poi].ioNum--;
    + E6 d- R0 x6 r( @% t! f; i& achange += exchange_IO_Compute;- f# o, C4 F$ J* |( C# u
    waitio++;. A& v1 q; N. ]* X) I" T
    }" P) |8 b( l) ?1 ^( V6 c
    else
    - B" h7 F- O- T7 f$ v2 L5 Y2 `{% |) w$ Z2 h) D- A& W" F4 T
    waitio++;& G. d' x# w1 c1 N# S
    }$ S4 h/ k2 ~, J- \
    }
    . j1 d* B; j/ v! Delse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)
    / v: N, {, K9 d8 p4 p( B{1 ]! w3 i! L5 M# A4 y; w
    (* memory).p[poi].flag=IO_waiting;
    4 z, M4 B: q& mchange += exchange_IO_Compute;
    6 |  p, p; w' Y}
    + q" v+ l  }7 p. belse if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    : c, o$ `0 ?5 _' X) [/ p9 ^6 J) W{
    ) {1 H; }! Z$ _+ L# ?. Z1 [7 k4 l(* memory).p[poi].flag=computing;4 `8 X, j1 g) g! P% X
    change += exchange_IO_Compute;
    * S, w# ^3 K  E+ h. U}
    2 t1 J( ~7 Y0 C0 k% p, {$ Nfor(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进3 f+ I1 v  C( ^- P/ [* k: W& E
    {
    0 E% h8 d4 L# |  T" G4 [if(i!=poi && (*memory).p.flag==IO_waiting)
    5 h1 U% P! U3 y4 J: v' @, z4 z{9 E8 m- Y- Z; c4 x  p% q
    j=(*memory).p.ioNum;
    ; L  V  a! T- k* g: xif(j>0)& P% W0 D$ V4 U. {6 q$ G, P
    {7 [& U  D6 v( S6 l- e$ Q/ t
    if(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    / |  b/ g! E* U9 n( z! y2 C{; t2 l& `( t" h% l
    (*memory).p.flag=computing;. z' t) _$ o  w. @8 c& N9 ?0 s) \1 W
    (*memory).p.ioNum--;
    ( b/ b% ~9 }- Z# Z9 w6 |# |change += exchange_IO_Compute;
    9 N9 s; ~' d/ D) p}
    0 s( f9 l" f; c- N1 C}
    : l+ B% S2 f# t& U}* D. E! T3 e+ S8 K; A5 }& z
    }
    / M3 L6 r% U3 T5 xfor(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程
    3 Z' f" u5 \7 {/ k% k" J{
    # C+ o/ H1 ^: F( Z0 d) |if((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed; [, m- T% F. R
    {/ c, o& {, [9 ]0 `5 N
    (*save) = (PCI*)malloc(sizeof(PCI));
    ! K* A) O2 F8 J5 C* }  U(*save)->next = NULL;
    $ J3 D. d$ J" n* k# F* S0 [       (*save)->processID = (*memory).p.processID;/ T- R1 f5 F( Z: v* M; s1 j
    (*save)->comeingTime = (*memory).p.produceTime;5 g; X' Z5 @" P3 [. p
    (*save)->askMemory = (*memory).p.askMemory;* p9 n/ B' W9 r+ n- R$ J; J% ?* B
    (*save)->compute = compute;1 ]! t0 ?5 H% f1 \+ }
    (*save)->waitio = waitio;7 P0 ?% ]/ Y1 K  ^( N* S
    (*save)->exchange = change;
    1 y& o' O- u- n& K6 w0 N' Y, U& A(*save)->completedTime = systemClock-(*save)->comeingTime;
    # S4 P# b8 p: s/ M* G3 r$ L( w(*save)->runningTime = (*memory).p.runningTime;9 |! |& z, G4 g9 ^$ [# r
    (*save)->completedTime = systemClock;! W' T# I  o4 n& V9 Q
    *spareMemory = *spareMemory + (*memory).p.askMemory;
    # X4 \. i: I0 J% a& f1 [! [- ycompute=waitio=change=0;
    8 g. Z' y( k. McomputeLast=waitioLast=changeLast=0;
    ' m$ \( E; k# W4 j  Jif(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入( I: W3 q2 o1 k5 A8 q- H
    {! c. ~( g8 H! C8 o' Y
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程: i+ q5 r, n0 F& U
    {' z% H; I7 J% u; Y4 H
    poi++;
    5 G) A; h$ Q4 @  ]$ L   clockSegment=2000;# [  W( e) ?% z& q
    }
    ; \; z% w4 g! t2 n0 l}, V* G" F$ J7 p: G6 Y& j- E5 @
    else  //没有足够内存调入新进程
    8 ?8 o% Z$ T8 {4 B8 @( K+ R{
    ; Z- }" {% V. G: F' y$ N' D% gif(i < (*memory).proNum-1)
    . ~( b8 m$ W! Q  S% F& E8 h% X/ T{" M* e& M! q) _2 e7 z
    for(j=i; j+1<(*memory).proNum; j++)- {7 _9 |  g' Q  F" Q4 [
    {% S7 k4 X$ ~7 \. {& x$ W: z
    (*memory).p[j].askMemory = (*memory).p[j+1].askMemory;
    2 ]! ^6 h7 o5 u; S3 i4 x(*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;! C! W) |: W! _8 X! c. ?
    (*memory).p[j].computeNum = (*memory).p[j+1].computeNum;+ `; K* V% Q) h1 @1 s# h
    (*memory).p[j].ioNum = (*memory).p[j+1].ioNum;- n2 ]! p- s( N6 {+ E4 k* T
    (*memory).p[j].processID = (*memory).p[j+1].processID;; b: l# {$ f' R
    (*memory).p[j].flag = (*memory).p[j+1].flag;
    / r# F/ |/ @! c) I(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;& T9 ^: S+ t2 V2 \4 \6 b! M  V
    (*memory).p[j].computeTime = (*memory).p[j+1].computeTime;
    , p! o# F6 ?0 I1 r(*memory).p[j].runningTime = (*memory).p[j+1].runningTime;
    ; D2 j% X! C: z' A6 N- _(*memory).p[j].produceTime = (*memory).p[j+1].produceTime;
    0 w6 e. w- J7 T' Z( _: k(*memory).p[j].completedTime = (*memory).p[j+1].completedTime;' N4 ~2 ~3 g9 {- N" h1 h  c
    for(k=0; k<(*memory).p[j].computeNum; k++)  J/ C: K3 ~, S1 e
    (*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    ' Q" \8 y3 ^' g5 A+ E. d6 i. Vfor(k=0; k<(*memory).p[j].ioNum; k++)
    1 s3 S. m2 d# h7 L) g3 q0 k(*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];
    9 \( a$ D9 r$ y* b1 K8 T}8 C. o2 w1 q2 g/ T( r
    if(i<poi)
    $ ~* |; c6 b& `8 ^3 d! J* Qpoi--;
    0 d+ z$ K3 v+ e7 K) x+ Xelse if(i==poi)
    8 @( X2 F0 g. T, D, W* z; |clockSegment=2000;
    , N) Y+ \! z  r}6 k- Z* g: o' c
    i--;
    7 u! }  r5 F6 X/ s+ X(*memory).proNum--;  e# R- z0 u5 V. }" S
    }
    % ]1 l: n& ^) ^/ {return task_completed;% Z+ q1 v  Z0 F: o
    }& U# J. c! O6 P0 k
    }- q% p# m0 r' k/ c
    --clockSegment;0 q* b( T1 k  V; v
    if(clockSegment<=0)
    ; q- N( t' ]: @{' ]5 C3 T. i. h% z. u. h+ y; s! N/ Z
    poi=poi+1;
    & U) i. h" `8 q1 ?- H: \$ m* |1 H5 Oif(poi>=(*memory).proNum)( w% m- K; J7 t6 v
    poi=0;: u* q8 C$ M6 m/ U7 [% J5 X
    clockSegment=100;0 n- O- B- m" W( ~- h" ?
    }) I/ S$ U0 F3 e* d. c, R
    return task_not_completed;/ C5 @" x% w; l4 Y' ?3 ?
    }4 L: Q5 o/ i0 ?4 n; `1 H& z3 S# l9 w
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)! _' ]8 S. \+ X) L% p. m4 a
    {1 U7 X4 @' [) ?  B+ W% u% L  C8 L+ [
    int i=0,j=0,k=0,flag=0,translation=0;0 S8 y6 u7 C9 [6 I3 K) Q) ^/ |
    for(i=0; i<(*storage).proNum; i++)1 r4 v$ i4 K4 }3 [- h  |0 d
    {' ~6 m# U6 p3 P$ `' j; [
    if((*storage).p.comeingTime>MAX_COMING_TIME)6 A$ `4 ~4 u; X$ m
    MAX_COMING_TIME = (*storage).p.comeingTime;" n2 y5 @8 ^+ v6 o
    }9 Y/ O( M# g' c- ]: V" U4 u1 o
    if(pos>=0)6 k! d( e: ]% Y& N& U& A% l4 k
    {
    " }6 N% ~: I/ Mfor(i=0; i<(*storage).proNum; i++)
    # \( K; L9 N# z  o{
    : i/ u% Q  e: O! ?( z0 P! u) yif((*storage).p.askMemory <= *spareMemory)3 q, Q# Z1 C. P9 m% ^. N
    {
    0 n4 ^: c! D  B& L( Vj=pos;
    4 H3 d! ]" R0 ~5 B7 R(*memory).p[j].askMemory = (*storage).p.askMemory;
    7 |; R; K5 K  k$ Y* u(*memory).p[j].comeingTime = (*storage).p.comeingTime;, o4 p; f1 m& J/ D" }
    (*memory).p[j].computeNum = (*storage).p.computeNum;
    8 }8 ^# q& T$ d, Z( h8 z(*memory).p[j].ioNum = (*storage).p.ioNum;
    4 s% _" l$ W* K- `" g: D+ h/ ^(*memory).p[j].processID = (*storage).p.processID;, x) ~& M, `+ c9 _" M
    (*memory).p[j].flag = (*storage).p.flag;' c8 b1 Z9 V: n
    (*memory).p[j].ioTime = (*storage).p.ioTime;  D) e% b- {- E" }
    (*memory).p[j].computeTime = (*storage).p.computeTime;
    ( I4 i1 Y  }. i(*memory).p[j].runningTime = systemClock;! _+ V, J: N9 d3 u7 s0 n) l& |
    (*memory).p[j].produceTime = (*storage).p.produceTime;" l8 w6 ~3 C( s: }# R/ c! H
    for(k=0; k<(*memory).p[j].ioNum; k++)
    8 x) f- Z' \1 f8 k4 a9 a(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];* p& G+ i: f- M- z2 ~
    for(k=0; k<(*memory).p[j].computeNum; k++): |/ Z. P3 q/ f% k
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];4 k- V7 ]! K" w
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;5 z. {3 Y6 {# ]+ v
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程2 g9 R5 d7 c: v5 T1 G6 F
    MAX_COMING_TIME = (*storage).p.comeingTime;
    4 t+ V, S3 X( g+ |+ V3 ^! rtranslation=1;, |8 R4 g) r8 n- P9 v' Q! [
    break;
    , F' n9 Z. S; L$ i8 {}
    * u* \' C) y' Z# g}
    % ?! v4 d( z8 M, N}/ S0 ^* k2 A+ o8 S5 d: r- b
    else
    , J* v2 d% E+ Q4 Z5 [" @{- s$ J! ~$ N+ i5 i+ N" b# j: ^6 d7 [0 [
    while(1)9 j, F  V+ W- I! {9 D" y
    {3 ?; r+ E  E& b' p7 I
    flag=0;
      B* K! o4 f7 `) A& _! l) P! p* u2 cfor(i=0; i<(*storage).proNum; i++)3 C+ w) O/ N3 g" W& |6 {; g1 G7 z
    {* ^3 t- X- _! {: Q" \: m
    if((*storage).p.askMemory <= *spareMemory)
    2 Q9 z7 O0 W$ |{
    ; x. \3 O$ b) K2 S9 L, |j=(*memory).proNum;3 |: Z" v  y4 g7 S" u8 n; c
    (*memory).p[j].askMemory = (*storage).p.askMemory;& }. V2 Y; r2 q8 B: M
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;
    - W! I! O- Q2 x* I5 s/ J9 }; z(*memory).p[j].computeNum = (*storage).p.computeNum;
    % r2 C% ^0 M1 D4 @8 e2 n4 H& W(*memory).p[j].ioNum = (*storage).p.ioNum;
    7 i) g% R& {6 _; |- F* d(*memory).p[j].processID = (*storage).p.processID;
    7 L% I5 S6 Y$ [! W8 C# L* r(*memory).p[j].flag = (*storage).p.flag;. j! P& a: Q5 v+ c
    (*memory).p[j].ioTime = (*storage).p.ioTime;
    0 K% s) P: p) n: w(*memory).p[j].computeTime = (*storage).p.computeTime;
    ) s0 _: @# V) x3 ^/ s4 i8 U# {! L0 J(*memory).p[j].runningTime = systemClock;6 l; f' R+ e7 t6 i3 y
    (*memory).p[j].produceTime = (*storage).p.produceTime;
    " R/ I# ]: {+ n; \# D2 Zfor(k=0; k<(*memory).p[j].ioNum; k++)
    2 Y) T; f% p5 w0 @7 K0 ](*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    $ X. G2 i  }1 Z' nfor(k=0; k<(*memory).p[j].computeNum; k++)( C$ V0 ]3 w: |3 ]- F, `0 J
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    0 k7 N+ @- J4 @4 W; U, l(*memory).proNum++;. @6 {3 m8 y( }3 ~. N# E# I+ R
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    ! D4 z$ i! G  h! E" W# J/ cproduce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    - c% E( D0 i% w1 ?# rMAX_COMING_TIME = (*storage).p.comeingTime;+ N8 D3 t( e0 r& T' |: m
    flag=1;4 A9 w4 Z% H- [: g6 c$ ?
    translation=1;
    2 [5 W$ ~$ [9 x( z}( R9 D" B. q+ a: R
    }  p5 Y5 {5 X+ Q  H; N  A& P
    if(flag == 0)0 X0 D5 U2 W' m/ v! K- e$ n# O0 z
    break;
    ) B: G, s3 \9 _( d# R}* R. b7 R. T1 h5 B5 T2 R
    }* M+ E7 Q  Q% h4 T1 X
    return translation;
    9 \- ]& E0 n9 D, L8 a}: a  `4 `. N* h8 h0 G% C9 ^, L
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)
    ) }' P6 s; ?  w% Z{8 c: e; h3 L8 o7 y
    static int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    9 ^- J( |$ E0 v. I( A& N) bstatic int computeLast=0,waitioLast=0,changeLast=0;
    ) d% \& K6 J9 n( eint i=0;
    9 ^8 a! V# A& o) {if(draw==1)
      @- a6 Y5 _6 X$ [5 ~{$ \) s  T- b8 ~- j
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);# ~. U* U  ~# }) v; d5 l. i8 n
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);3 Q- U2 K; W" ?) m0 h6 D5 R

    - r# y$ F8 B; e7 u
    / a  e. c6 N6 e: w+ s0 R9 icomputeLast=compute;7 [8 T$ J$ p/ ~# g2 @
    waitioLast=waitio;% ?5 S7 @4 l) i
    changeLast=change;2 W7 x8 T- H: Z  F2 F
    }
    - p# k% t" s& q/ q6 r% Xif(flag==1)  
    # ]! r/ y1 C2 c; o" K{* A' L6 o8 n5 [1 E3 B, T
    if((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed% t2 D6 l1 R+ T6 F  Q
    {
    # c, ?2 j& c/ Q4 d" }9 F% Iif(flagiocpt==0)   // implement compute
    : R! G$ O5 @% Y" ]{
    4 E* `( s% U$ o  o( {0 fi=(*memory).p[0].computeNum;
    0 T) S% f* `( l# yif(i>0 && (*memory).p[0].computeClock[i-1]>0)# X6 a' ~- {% C4 r
    {
    0 p7 g. d& \5 ~7 c+ T7 ^: a( Q9 ~7 oif(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed* b( A: J5 ]: f6 C, I1 H" Z4 l; X8 R
    {" D. d! V5 |  p, D
    flagiocpt = 1;( [: a' n% n6 `6 F$ j8 }4 l
    (*memory).p[0].computeNum--;
    * W2 X4 G: D9 b$ E9 ?* m: ~change += exchange_IO_Compute;
    % m! R  {- @/ o7 w( J9 L3 T/ A4 hcompute++;
    ( T' g" U6 Q) l- P* ^5 M# d}" M* U$ c# |" `9 {  m- @
    else: X: E6 Z6 q; _: Z
    compute++;
    4 O! d) u' n4 l8 u; F9 o1 ]
    $ v8 m3 w" h, @; A" |}
    5 @" v/ Q% ]4 gelse
    " o( @) l6 f- F( ~7 }( Iflagiocpt = 1;4 Z5 ]8 C3 T) w: E9 z
    }
    5 L3 e3 q: P; X% Nelse  //wait io
    6 S. v) ~* G; X/ J# W1 x7 i% m{% g  k8 k1 k1 S  G1 O: H( f
    i=(*memory).p[0].ioNum;, {3 }  f7 N. l
    if(i>0 && (*memory).p[0].ioClock[i-1]>0)
    4 P) o$ }$ y& f# `  W5 h{& l& C9 I+ P3 ~' g) S
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed# Y- g( U- J9 Q
    {+ ]2 P- V2 n/ y1 \' ~7 i
    flagiocpt = 0;  D! A4 ^  `1 ]+ a" ^0 h  _
    (*memory).p[0].ioNum--;: U) V" ?' ]+ |  h7 L% B' j
    change += exchange_IO_Compute;5 w6 \; t, o, ^) l3 @# a" N9 i
    waitio++;
    8 |( I. G, s6 }: [* v/ o}, |) T  G# D& [. x
    else
    ) R! j' N; w( H; h( Xwaitio++;" I& t) B9 L, T. C

    ! L, O. G+ c/ }6 s" n  g) s}
    . X9 ]% \4 |* welse
    / N/ k" T# J2 F; `6 |2 U7 K; I8 Kflagiocpt = 0;8 r: e& Z4 j" T
    }* w$ v4 U7 x- U! k2 w: c
    }7 ^6 Y7 y5 h: `0 b; t% q( c0 N2 z
    else  //task is completed+ D( U2 r$ q9 r! d! N( s4 f
    {6 g5 P3 C7 u4 v7 _% a, E# r
    (*save) = (PCI*)malloc(sizeof(PCI));
    : P/ _% T7 g( o# U+ h8 v& B(*save)->next = NULL;
    * n4 e* s8 A  U1 ?$ E: y       (*save)->processID = (*memory).p[0].processID;. Y* U: q  p$ w% v. _5 J
    (*save)->comeingTime = (*memory).p[0].produceTime;
    9 ?; O! o$ Y& ^8 _(*save)->askMemory = (*memory).p[0].askMemory;
    * T' g: G' G: o" _(*save)->compute = compute;& E2 ~' U. R- q6 h
    (*save)->waitio = waitio;  q2 o! K' a" J+ c. B' g& M
    (*save)->exchange = change;; j: o) @9 |3 l$ a' G2 w
    (*save)->completedTime = systemClock-(*save)->comeingTime;+ ^1 r- L: R$ E
    (*save)->runningTime = (*memory).p[0].runningTime;9 e+ a1 f/ i- k+ e
    (*save)->completedTime = systemClock;' W9 G3 R6 N- Z( K. F* @: O
    //*spareMemory = MAX_MEMORY;
    0 S0 U8 J# P6 Y$ c4 F4 hfree((*memory).p[0].ioClock);% Y6 J" L, v- B1 P
    free((*memory).p[0].computeClock);
    0 F. B4 a( P; Z5 ?. Nfree((*memory).p);
    1 C1 }" `4 c+ j1 \. J$ Cflag=0;
    * i- ~2 n4 K5 a5 X! Y% Ocompute=waitio=change=0;4 E" i% |4 |' s9 K8 X$ E2 ~
    computeLast=waitioLast=changeLast=0;0 t  l% H. a" K
    return task_completed;* y) B% x; P) w3 T6 V) s7 x) X
    }( Q7 {: `, W2 X2 ~8 w/ W/ I1 J" Y9 D
    }4 w+ m& t$ ]; V' }, m: u* m5 G
    else         & D1 l1 y9 v" |& o- G, I
    {6 }1 D" z% g: \
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));% S6 ~, b. h" M+ c
    change += exchange_process;
    $ x2 x  Y+ c& g& i//*spareMemory -= (*memory).p[0].askMemory;- s( n+ ~& u5 y" e
    flag=1;
    % e9 Y& V  G9 @  y1 }' k5 B4 Q//showProcessInf(*memory);
      X% u) s7 R1 V0 c; ?( Preturn task_not_completed;/ B; J0 K7 f" ~' y) u
    }
    - M4 S, w) a; V1 t% Kreturn task_not_completed;
    # \+ W+ x, G. f9 a/ _3 Q}
    9 l6 n" _( ?) H) U- sint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)) b/ [8 ]9 G$ b% [9 h
    {! W, a' M: P  V1 m! e" g
    int i=0,j=0,k=0;- E2 o1 C# H$ x& I* D
    MAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;- j0 L4 |2 j  ^
    (*memory).p = (process*)malloc(initProcessNum*sizeof(process));
    : P: v9 }; N$ O& vmemory->proNum = 1;' e* f; b, l5 A: u: Z
    for(i=0; i<initProcessNum; i++)8 O; M6 X4 x  s5 {. _( N2 ?9 a5 J7 C% X
    {
    0 z% I) Z; h: L5 aif((*storage).p.askMemory <= *spareMemory), E& r3 T( B" y! v8 u# ?
    {1 n9 {* X, W1 C7 }! o; \% r$ d
    (*memory).p[0].askMemory = (*storage).p.askMemory;
    ) l4 p7 ~- B! }; ~+ ~: e0 `4 A5 F(*memory).p[0].comeingTime = (*storage).p.comeingTime;+ D& s% C' a: K) S7 Y/ K6 B5 j# q
    (*memory).p[0].computeNum = (*storage).p.computeNum;4 s- `2 }) }. _& P
    (*memory).p[0].ioNum = (*storage).p.ioNum;
    1 Y: ?5 ]/ v9 d/ d! ~* F(*memory).p[0].processID = (*storage).p.processID;
    ' u" c2 r/ o% @$ Z' n$ b, p/ X(*memory).p[0].flag = (*storage).p.flag;& Y  b1 C7 U: n" C) c# i
    (*memory).p[0].ioTime = (*storage).p.ioTime;5 @* [# S: u$ ~! e4 q# O2 t
    (*memory).p[0].computeTime = (*storage).p.computeTime;0 ?8 e' K, G& Z8 E$ Z
    (*memory).p[0].produceTime = (*storage).p.produceTime;& z7 s* D1 p0 J! Z" h' O
    (*memory).p[0].runningTime = systemClock;, m( h2 t" p7 ?2 H; z+ ]' [2 j
    (*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));/ K+ h. K) O, B
    (*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));
    9 T/ O  ]( A: H& ~" Q* Pfor(k=0; k<(*memory).p[0].ioNum; k++)
    7 J: w" h; m: R" K! ]: P" `& G(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];
    2 Z6 R9 A  z: Q/ `% E9 r6 n/ T; ]for(k=0; k<(*memory).p[0].computeNum; k++)  B( w/ [) W9 y5 l: J. N
    (*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];; X0 @, y( q  p! c  m
    break;' C# F2 s3 |; `4 K
    }
    2 o- ^# z- ]# ~7 D}, _  |2 D, `. q9 S' I
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入
    ! \& ~9 \: C5 |  `) R, u{
    2 ]* }4 i" S0 Dproduce_one_task(storage,i,ID_FIFO++);
    - F( B& C9 K3 V6 S; G6 I- n, NMAX_COMING_TIME = (*storage).p.comeingTime;
    5 t. w' W% r! t6 c( B4 Asort_by_comingtime(storage,i);0 d8 E' e7 S) l  r& h7 C
    }  R' \! B6 [% }+ D) I* @; a8 ]
    return 0;9 L: J2 a5 l: @$ ^1 v2 E8 F
    }# S6 p' m/ w. y2 ?3 L5 N" e* u8 D8 t
    int sort_by_comingtime(processPool * p,int pos)
    6 }0 i& A8 i) U/ H0 U" w" A{. S6 p1 z' \, L$ v
    int i=0,j=0;
      }7 g$ n% _' @. rprocess temp;4 t- o- P+ K& ^' `
    if(pos<0)
    # V, r1 l) H1 i, x  w$ a8 E! J{* K, ~) v% i: S- g( R6 t
    for(i=0; i<initProcessNum; i++)0 T( g$ M) b9 E( G1 {, g
    for(j=0; j+1<initProcessNum-i; j++)' x2 S: U( K+ y" O! j
    {; S( w  j0 M2 c* Y( _+ k
    if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)( X0 [0 y9 T+ e8 k9 m
    {
    ' E- S7 R9 n/ H) N! _  ctemp = (*p).p[j];, q; X" h. F2 Q' J
    (*p).p[j] = (*p).p[j+1];
    " K( H6 S+ o5 n% [. y(*p).p[j+1] = temp;
    1 G) t/ e4 B( p9 q' t3 ^. x7 V}
    ) ]5 G6 z/ t1 X- e- c}
    3 p1 J& C3 s0 _}
    # Q4 ^# ]9 D. }1 T: C% K4 Kelse if(pos<initProcessNum)
    9 N" v8 |& x7 `) b, |# r2 E{
    : I* J3 F5 I( H5 W( e3 tfor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)+ u1 M& i/ p' Y3 M" V
    {
    2 J$ D5 N! p( P# G* ]8 E5 w8 Stemp = (*p).p;) A9 U9 P( [) P+ Y' v
    (*p).p = (*p).p[i+1];  L! n0 x; c6 {  x
    (*p).p[i+1] = temp;5 e& t; R, H6 j( i# M7 c
    }4 `( N  r! Z; a0 F3 k
    for(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)
    4 ^  P$ C) E' Y! m/ H5 O{: {) T5 d. B; y7 F5 U( D4 {5 \
    temp = (*p).p[i-1];
    2 L# A; Q/ c. X# S, w4 z: \% H# O( w(*p).p[i-1] = (*p).p;- {; C* V6 h" m, _
    (*p).p = temp;* W& p" c* Y1 B; t
    }3 Q: \5 D0 A& ]: f: W
    }
    2 t) @6 K; X, |$ }; i7 zelse
      x7 ^4 e6 {' m& @& k- s1 T9 Iprintf("position eror\n");6 n+ @* f2 H# B5 y  A
    return 0;
    * ?9 b( I0 ?0 h$ B5 X}, \* c9 {' x9 U9 N2 Y& K
    int InitPool(processPool * p)" m( @, j, J/ T$ p; h5 \/ _0 V! ~
    {8 j$ n+ A! e1 f5 T) c" ?4 f
    int i=0;/ F- Q: n2 h% q* J  A& r% {. U  a
    (*p).proNum = initProcessNum;
    % u' ]3 C7 t* Q! E5 m(*p).p = (process*)malloc(initProcessNum*sizeof(process));  |# @0 [9 m0 E/ r
    for(i=0; i<initProcessNum; i++)                                        //init process information, S: `3 X9 N% a! [4 B9 H3 l4 ]
    {3 U$ a4 m1 o# o* q
    (*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));
    * @! T; N  i. i: @(*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));  M- A1 Y0 c( W
    produce_one_task(&(*p),i,ID_FIFO++);
    : X, t" T, n2 i3 |$ O& r) ]}9 C2 D$ ]) R$ A* s8 N
    return 0;
    ; I% c9 A& ]. C5 Q- q+ G/ x( i}' g/ b) }+ z- c
    int produce_one_task(processPool * p,int i,int id)4 u- Z9 D4 a; _2 ~. }
    {$ G( U6 ?0 }% s- g9 m
    int time=MAX_COMING_TIME,j=0,totallTime=0;# m7 m, P7 v0 B; r8 Q& f. ~
    (*p).p.processID = initProcessID+id;           : V# y; C7 R7 d6 w# S# }
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);8 r( J* m5 P  E* U( u3 n* P
    (*p).p.produceTime = systemClock;3 S: s$ w" ~9 @- L0 f5 L/ @
    (*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    * s0 s" O" |1 e$ a! c(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    7 }) M) A" O8 t+ z# e" ctotallTime = (*p).p.computeNum  + (*p).p.ioNum;
    + f! p7 {4 v: t1 d6 ]+ F2 a& a- f(*p).p.computeTime=0;
    ! }( i' w# }% ]for(j=0; j<(*p).p.computeNum; j++)
    3 v# H7 Q( {; n+ ~$ ^% y2 z- p) q{
    4 g  Z/ F6 ?5 n2 j4 W: Y* V(*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;: x9 x" p* N" u( g: N
    (*p).p.computeTime += (*p).p.computeClock[j];
    8 E5 {* ~6 i' m$ _0 U}8 ^  p' a' ~3 T# @9 ]2 t) i9 B
    (*p).p.ioTime=0;
    0 b8 y  L) R* h' ^& X# Wfor(j=0; j<(*p).p.ioNum; j++)
    + z+ N8 l) E  e1 a{# R' z6 p5 b" R- e9 S: b
    (*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;; v+ ~3 T: C6 e1 L
    (*p).p.ioTime += (*p).p.ioClock[j];
    ! @) x5 m# \, M% V6 g( C}% m3 D% r- ~1 L9 g+ g
    (*p).p.askMemory = rand()%(MAX_MEMORY/4);2 Y5 T: }4 e- Z9 ^# M' z; X7 Z9 ~
    (*p).p.flag = ready;
    - G9 E& X$ |% nreturn 0;
    7 G9 e! w2 c5 d% F, z& N}
    , Y( w+ F; X2 C- a5 Cint showProcessInf(processPool p)2 d+ s' ^# Y7 W2 x
    {+ F+ g! M' A  S# B3 F9 Q" R
    int i=0,j=0;, K' b: Y# i1 K! T, y8 {
    for(i=0;i<p.proNum;i++): L$ q2 ~' N2 M3 P7 s) S" u
    {
    . i; `% }0 M- E( a! `printf("ID:%d,%d,%d,%d,%d,%d,%d\n",p.p.processID,p.p.comeingTime,p.p.ioNum,p.p.computeNum,p.p.ioTime,p.p.computeTime5 z2 _! p3 W2 O! p$ ]( H
    ,p.p.askMemory);3 r+ [/ e! ?( d; t
    for(j=0;j<p.p.ioNum;j++)
      }) q$ f5 K1 ?# b  s; }$ M{2 ]' N: c# A# x$ N6 y
    printf("%d ",p.p.ioClock[j]);' X2 d. L* |8 `% m& f: _8 b
    }/ A+ N8 S; r( u0 P, h
    printf("\n");# x( P8 A# _: U* P: P
    for( j=0;j<p.p.computeNum;j++). F# v# z" G9 E( ]+ M
    {
    " s0 P% g# L3 c4 j' Uprintf("%d ",p.p.computeClock[j]);
    ' \  N- D, W& Q* H, }- H5 G}
    1 P2 d0 m; r% ]# E  d6 vprintf("\n");/ m% `# s% v( I- i
    }
    1 B1 m( e* F# ^6 Breturn 0;
    ' E: z$ v: i$ b2 q, T}
    ( U5 U0 ~. S' x————————————————9 Z& Q4 I+ U# P7 h1 ~" r$ {
    版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    $ Q- B- W* M2 B' c' K3 Z: K8 H原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519
    , {0 D8 M$ j3 X5 G# Z5 Z  w* D9 _% g  g

    : Z2 Y$ K, B- h7 g9 R2 e& W
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2026-6-9 14:31 , Processed in 0.353077 second(s), 50 queries .

    回顶部