From: yangyu <ya...@hp...> - 2007-10-05 10:04:22
|
Hello Dear Agustin, Thank you very much for you kindness and your help to me. I just had a try. I found that there is some problem in that code. ------------------------------------------ for(int i=3D0;i<num;i++) { =20 // get a PE of this resource=20 // something like: // pe=3D pelist.get(i); =20 // then change the rating pe.setMIPSRating(1000); =09 } ------------------------------------------ The prolem is with the code "pe.setMIPSRating(1000);" when compling . some information like "pe is not defined symbol" was shown. To work out this, at the head of my class I wrote "public static PE pe; = " (I am not sure of it, just a try). and the Compling is passed, but when it run to the code = "pe.setMIPSRating(1000); ", the program will be stopped and throws a = message of "java.lang.NullPointerException". I thought that when the excution of program runs to " = pe.setMIPSRating(1000);" to set the PE with a new_speed, maybe Program = can not know which PE`s speed is going to be re-setted. (As the message = of NullPointerException) . And I also tried to use " pe=3D pelist.get(i);" , but a error message = like "java.lang.Objct can not be setted as gridsim.PE" was shown. I really want to say "Thank you very much for your help to me. you are = so kind", though I can not run your code correctly. I will go on to find how to change the performance(speed of PE). And if you have some new information about change speed of PE, I `d = like to read and try it. Thanks a lot, best wishes to you. Yang Yu -----Original Message----- From: Agustin Caminero Herraez [mailto:ag...@ds...] Sent: Friday, October 05, 2007 4:39 PM To: yangyu Cc: gri...@li... Subject: Re: [GridSim-users] about dynamic performance. and a question of setting resourceID Hello Yang Yu, I've just taken a look at your example, and I'm afraid that what you do=20 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=3D0; int rate_changed=3D0; PEList pelist=3Dresource.getMachineList().getMachine(0).getPEList(); int num=3Dresource.getNumPE(); /*to see the rate of PEs before change them. there were 6PEs and each = PE~s speed is 200*/ for(int i=3D0;i<num;i++){ rate=3Dpelist.getMIPSRating(i); } /* try to change speed to 1000 */ for(int i=3D0;i<num;i++) { =20 // get a PE of this resource=20 // something like: // pe=3D pelist.get(i); // then change the rating pe.setMIPSRating(1000); =09 } /* to check that they are changed or not*/ =20 for(int i=3D0;i<num;i++) { rate_changed=3Dpelist.getMIPSRating(i); //rate_changed is same as rate. } } Tell me if this works, Regards, Agustin yangyu escribi=C3=B3: > 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=3D0; > int rate_changed=3D0; > PEList = pelist=3Dresource.getMachineList().getMachine(0).getPEList(); > int num=3Dresource.getNumPE(); > > > /*to see the rate of PEs before change them. there were 6PEs and each = PE~s > speed is 200*/ > for(int i=3D0;i<num;i++){ > rate=3Dpelist.getMIPSRating(i); > } > > > /* try to change speed to 1000 using the method that I know*/ > for(int i=3D0;i<num;i++) { > pelist.add(new PE(i,1000)); > > // PE pe=3Dnew PE(i,1000); > // pe.setMIPSRating(1000); > } > MachineList mList =3D new MachineList(); > mList.add( new Machine(0, pelist) ); > String arch =3D "Sun Ultra"; // system architecture > String os =3D "Solaris"; // operating system > double time_zone =3D 0.0; // time zone this resource = located > ResourceCharacteristics resource =3D new ResourceCharacteristics( > arch, os, mList, = ResourceCharacteristics.SPACE_SHARED, > time_zone, 1); > > // PEList = pelist1=3Dresource.getMachineList().getMachine(0).getPEList(); > /* to check that they are changed or not*/ > for(int i=3D0;i<num;i++) > { > // = rate_changed=3Dpelist1.getMIPSRating(i) > rate_changed=3Dpelist.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 > =20 --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D 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/ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D |