From:
<ag...@ds...> - 2007-10-05 07:38:59
|
Hello Yang Yu, I've just taken a look at your example, and I'm afraid that what you do is not correct. I mean, you are not changing the rating of PEs, but just creating new PEs. So, try doing this: public void changePE(){ int rate=0; int rate_changed=0; PEList pelist=resource.getMachineList().getMachine(0).getPEList(); int num=resource.getNumPE(); /*to see the rate of PEs before change them. there were 6PEs and each PE~s speed is 200*/ for(int i=0;i<num;i++){ rate=pelist.getMIPSRating(i); } /* try to change speed to 1000 */ for(int i=0;i<num;i++) { // get a PE of this resource // something like: // pe= pelist.get(i); // then change the rating pe.setMIPSRating(1000); } /* to check that they are changed or not*/ for(int i=0;i<num;i++) { rate_changed=pelist.getMIPSRating(i); //rate_changed is same as rate. } } Tell me if this works, Regards, Agustin yangyu escribió: > Good morning Agustin, > Good morning everyone, > > > Thank you very much for the information you gave to me. > I am happy to hear that the speed of PEs can be changed when the simulation > is running. > > I just tried one way to change the speed of PEs. It seems that it does not > work .(Forgive me if I chose a wrong way to write the code) I am not sure > the method I used is right or not. > Can you tell me why I can not change the speed(rating) of PEs when you are > not busy? > > Thank you very much. > > PS. I found that in the Class ResourceCharacteristics, the method > setResourceID(int id) does not work.(I can not make resources ID as I want > them to be.) > > (I am sorry that I sent this question to "GridSim-users] help regarding > compiling.............". 10minuts ago.I am so sorry about that.) > > bestwishes, > yang, > ---------the code-------------------------------------------------- > _/*I ran this program step by step to see "rate"and "rate_change".I found > that they were same*/ > public void changePE(){ > int rate=0; > int rate_changed=0; > PEList pelist=resource.getMachineList().getMachine(0).getPEList(); > int num=resource.getNumPE(); > > > /*to see the rate of PEs before change them. there were 6PEs and each PE~s > speed is 200*/ > for(int i=0;i<num;i++){ > rate=pelist.getMIPSRating(i); > } > > > /* try to change speed to 1000 using the method that I know*/ > for(int i=0;i<num;i++) { > pelist.add(new PE(i,1000)); > > // PE pe=new PE(i,1000); > // pe.setMIPSRating(1000); > } > MachineList mList = new MachineList(); > mList.add( new Machine(0, pelist) ); > String arch = "Sun Ultra"; // system architecture > String os = "Solaris"; // operating system > double time_zone = 0.0; // time zone this resource located > ResourceCharacteristics resource = new ResourceCharacteristics( > arch, os, mList, ResourceCharacteristics.SPACE_SHARED, > time_zone, 1); > > // PEList pelist1=resource.getMachineList().getMachine(0).getPEList(); > /* to check that they are changed or not*/ > for(int i=0;i<num;i++) > { > // rate_changed=pelist1.getMIPSRating(i) > rate_changed=pelist.getMIPSRating(i); > //rate_changed is same as rate. > } > } > -------------------------------------------------- > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Gridsim-users mailing list > Gri...@li... > https://lists.sourceforge.net/lists/listinfo/gridsim-users > -- ======================================================== Agustin Caminero-Herraez PhD Student Computing Systems Department The University of Castilla La Mancha, Albacete. Spain. Phone: +34 967 599200 Ext. 2693. Fax : +34 967 599224 http://www.i3a.uclm.es/ ======================================================== |