From:
<ag...@ds...> - 2007-10-05 10:21:17
|
Hello Yang Yu, yangyu escribió: > 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=0;i<num;i++) { > // get a PE of this resource > // something like: > // pe= pelist.get(i); > // then change the rating > pe.setMIPSRating(1000); > } > ------------------------------------------ > 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). > Of course, pe must be declared before being used. I think that "public PE pe; " is ok. > 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= pelist.get(i);" , but a error message like "java.lang.Objct can not be setted as gridsim.PE" was shown. > > Of course, before trying to set the speed of a PE, you must decide which PE you want to set. In order to do that, you must go through the PEList, which is what I meant in the code I sent you. Probably the failure is that "pelist.get(i); " returns a Object, so try doing a casting to PE, such as "pe= (PE) pelist.get(i);". Hope this helps, Agustin > 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 > 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/ ======================================================== |