How to find cpu Utilization of host ?

1,622 views
Skip to first unread message

Binal Parekh

unread,
Jan 31, 2016, 8:37:58 AM1/31/16
to cloudsim

i create one simple program in cloudsim which having a number of hosts , vms and cloudlets now i want to find out cpu utilization of hosts the how to use getutilizationofcpu method for host in cloudsim .. and i used this method get utilization of cpu but it only return 0 ..

vm utilization count same as host utilization in cloudsim.. is correct?

any help appreciate...plz help me 


this is my code

public double getTotalUtilizationOfCpu(double time) {

          double util = 0;

for (int i = 0; i <vmsNumber; i++) 

                {

Vm vm;

                        vm=vmList.get(i);

                         // vm.updateVmProcessing(CloudSim.clock(), null);

                         //double k = vm.getRam();

                       Log.printLine(" VM id is :"+ vm.getId()+ "its ram is "+vm.getRam() +"its MIPS:" +vm.getMips() +"its BW is:"+vm.getBw());

                         //double a=vm.getTotalUtilizationOfCpuMips(time);

                        //Log.printLine(" mips utilization is :"+ "   "+a);

util= vm.getTotalUtilizationOfCpu(CloudSim.clock());

                       Log.printLine(" VMid is :"+ vm.getId() +" utilization is : "+util);

                        

                }

  return util;

       }

Manoel Campos

unread,
Feb 4, 2016, 5:29:44 AM2/4/16
to clou...@googlegroups.com
Hello,

I haven't had success with this too. The class Vm has a stateHistory attribute.
Looking at CloudSim code, this state is supposed to be updated by a HostDynamicWorkload host.
However, no entries are being added to the stateHistory list of the VM.
But I think this is to be the way to do what you want, however, 
there may be some issue with this feature that needs to be assessed.

The example below gives you one idea of how that feature is supposed to work.
It uses a HostDynamicWorkload host instead of the Host.
See the showCpuUtilizationForAllHosts method and the others it calls.


I hope it can help in any way.

Manoel Campos da Silva Filho Developer and Systems Analyst
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

--

---
You received this message because you are subscribed to the Google Groups "cloudsim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudsim+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Binal Parekh

unread,
Feb 4, 2016, 5:58:29 AM2/4/16
to clou...@googlegroups.com
thank you so much sir

but it is based on usage history so i get no usage history output

--

---
You received this message because you are subscribed to a topic in the Google Groups "cloudsim" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cloudsim/MVVXolbAgVc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cloudsim+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--



Thank you  

Binal Parekh

Manoel Campos

unread,
Feb 4, 2016, 6:01:39 AM2/4/16
to clou...@googlegroups.com
Yes, it is what I mean. The history is not being updated, always returning zero for any time you give.
Anyway, there is a HostStateHistoryClass and and stateHistory list direct in the HostDynamicWorkload class.
The new example below shows how to use it, however, it always returns 0.


Manoel Campos da Silva Filho Developer and Systems Analyst
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 4, 2016, 6:09:57 AM2/4/16
to clou...@googlegroups.com
thank you sir

that means we cant find host utilization without its usage history.. 

Binal Parekh

unread,
Feb 4, 2016, 6:23:57 AM2/4/16
to clou...@googlegroups.com
i want to know 
 methods getUtilizationOfCpu() , getTotalUtilizationOfCpu() (which methods that already available)
using this methods can we find utilization of host ?

Binal Parekh

unread,
Feb 4, 2016, 6:26:05 AM2/4/16
to clou...@googlegroups.com
i want to know 
 methods getUtilizationOfCpu() , getTotalUtilizationOfCpu() (which methods that already available)
using this methods can we find utilization of host ?

so if  possible then i will use this all methods instead of usage history


Manoel Campos

unread,
Feb 4, 2016, 8:31:11 AM2/4/16
to clou...@googlegroups.com
Well, you said that the approach you tried always returned 0.
How I had seen the history attributes in some classes, I decided to try using them.

But in fact, the vm.getUtilizationOfCpu worked for me. 

Manoel Campos da Silva Filho Developer and Systems Analyst
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 4, 2016, 10:35:59 AM2/4/16
to clou...@googlegroups.com
thank you soo much sir..
i try all examples which u sent but  my program have some bugs at Cloudsim.startsimulation it stop working but i will try this also 

Binal Parekh

unread,
Feb 5, 2016, 8:52:06 AM2/5/16
to cloudsim

i got this type of error  
at org.cloudbus.cloudsim.core.SimEntity.run(SimEntity.java:406)
at org.cloudbus.cloudsim.core.CloudSim.runClockTick(CloudSim.java:518)
at org.cloudbus.cloudsim.core.CloudSim.run(CloudSim.java:882)
at org.cloudbus.cloudsim.core.CloudSim.startSimulation(CloudSim.java:188)
at csim1.csim1.main(csim1.java:98)

Manoel Campos

unread,
Feb 5, 2016, 4:27:55 PM2/5/16
to clou...@googlegroups.com
The error log is incomplete.
But maybe you aren't using the latest version of CloudSim, because I run without problem.

Manoel Campos da Silva Filho Developer and Systems Analyst
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

--

Binal Parekh

unread,
Feb 6, 2016, 10:33:44 AM2/6/16
to cloudsim
i am getting error at
Cloudsim.Startsimulator

NullPointerException is there  

Manoel Campos

unread,
Feb 6, 2016, 1:00:41 PM2/6/16
to clou...@googlegroups.com
Run the example with the latest cloudsim version.

Manoel Campos da Silva Filho Developer and Systems Analyst
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

--

Bhuvan Soni

unread,
Feb 6, 2016, 1:02:21 PM2/6/16
to clou...@googlegroups.com
I am cloudsim 3.0.3

From: Manoel Campos
Sent: ‎2/‎6/‎2016 11:30 PM
To: clou...@googlegroups.com
Subject: Re: How to find cpu Utilization of host ?

You received this message because you are subscribed to a topic in the Google Groups "cloudsim" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cloudsim/MVVXolbAgVc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cloudsim+u...@googlegroups.com.

Binal Parekh

unread,
Feb 6, 2016, 1:04:49 PM2/6/16
to clou...@googlegroups.com
Respected sir,

i m working on to minimize the power consumption in datacenter...someone told this not possible in cloudsim but i have very less time i have to do this 

but my first step is to find host over utilized or under utilized if it <30 then it under utilized make array of them that numbers of array of host are underutilized 

here i put my code sir .. i vry frustrated with all i didnt get any solution and didnt understand what wrongs things i did
package org.cloudbus.cloudsim.examples.power;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerDynamicWorkload;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModelStochastic;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.models.PowerModelLinear;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;

public class Csim4 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;

/** The vm list. */
private static List<Vm> vmList;
        private static List<PowerHost> hostList;
//private static double utilizationThreshold = 0.8;

private static final double hostsNumber = 2;
private static final double vmsNumber = 5;
private static final double cloudletsNumber = 5;
               
        private static List<Storage> storageList;

/**
 * Creates main() to run this example.
 *
 * @param args the args
 */
public static void main(String[] args) {

Log.printLine("Starting  example...");
                Csim4 n = new Csim4();
                     n.getNumberOfHosts();
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities. We can't run this example without
// initializing CloudSim first. We will get run-time exception
// error.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace GridSim events

// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);

// Second step: Create Datacenters
// Datacenters are the resource providers in CloudSim. We need at
// list one of them to run a CloudSim simulation
//
                    // PowerDatacenter datacenter = createDatacenter("Datacenter_0");
                       //  PowerDatacenter datacenter = (PowerDatacenter) createDatacenter(
//"Datacenter0",
//PowerDatacenter.class);
                        
                    PowerDatacenter datacenter0 = (PowerDatacenter) createDatacenter("Datacenter_0");
                   // System.out.println("power:" +datacenter0.getPower());
                    
// Third step: Create Broker
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();

// Fourth step: Create one virtual machine
vmList = createVms(brokerId);
                        
// submit vm list to the broker
broker.submitVmList(vmList);

// Fifth step: Create one cloudlet
cloudletList = createCloudletList(brokerId);
                        //cloudletList.add(cloudlet);
// submit cloudlet list to the broker
broker.submitCloudletList(cloudletList);
CloudSim.startSimulation();
                       
                    System.out.println("hello............");
                     List<Cloudlet> newList = broker.getCloudletReceivedList();
                   Log.printLine("Received..... " + newList.size() + " cloudlets....");
                         CloudSim.stopSimulation();
                        
                        printCloudletList(newList);
                        Log.printLine("cloudsim example finished");
                        
           
  
  
} catch (Exception e) {
Log.printLine("Unwanted errors happen");
}
                
               

//Log.printLine("SingleThreshold finished!");
              // if(host.getUtilizationOfCpu()<=30)
                      //  {
                            
                       // }
           
            //System.out.println("print this");
}

     
         
/**
 * Creates the cloudlet list.
 *
 * @param brokerId the broker id
 *
 * @return the cloudlet list
 */
private static List<Cloudlet> createCloudletList(int brokerId) {
List<Cloudlet> list = new ArrayList<Cloudlet>();

long length = 80000; // 10 min on 250 MIPS
int pesNumber = 1;
long fileSize = 300;
long outputSize = 300;

for (int i = 0; i < cloudletsNumber; i++) {
Cloudlet cloudlet = new Cloudlet(i, length, pesNumber, fileSize, outputSize, new UtilizationModelStochastic(), new UtilizationModelStochastic(), new UtilizationModelStochastic());
cloudlet.setUserId(brokerId);
cloudlet.setVmId(i);
list.add(cloudlet);
                        System.out.println("display" +(cloudlet.getUtilizationOfCpu(i)) +" _get vm id" +cloudlet.getVmId());
}

return list;
}

/**
 * Creates the vms.
 *
 * @param brokerId the broker id
 *
 * @return the list< vm>
 */
private static List<Vm> createVms(int brokerId) {
List<Vm> vms = new ArrayList<Vm>();

// VM description
int[] mips = {100, 150, 200, 250}; // MIPSRating
               // int mips = 250;
int pesNumber = 1; // number of cpus
int ram = 256; // vm memory (MB)
long bw = 2000; // bandwidth
long size = 2000; // image size (MB)
String vmm = "Xen"; // VMM name

for (int i = 0; i < vmsNumber; i++) {
vms.add(
new Vm(i, brokerId, mips[i % mips.length], pesNumber, ram, bw, size, vmm, new CloudletSchedulerDynamicWorkload(mips[i%mips.length], pesNumber))
);
}
                
return vms;
}

/**
 * Creates the datacenter.
 *
 * @param name the name
 *
 * @return the datacenter
 *
 * @throws Exception the exception
 */
private static PowerDatacenter createDatacenter(String name) throws Exception {
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create an object of HostList2 to store
// our machine
ArrayList<PowerHost> hostList = new ArrayList<PowerHost>();

double maxPower = 250; // 250W
double staticPowerPercent = 0.7; // 70%

int[] mips = { 1000, 2000, 3000 };
               // int mips=1000;
int ram = 10000; // host memory (MB)
long storage = 1000000; // host storage
int bw = 100000;

for (int i = 0; i < hostsNumber; i++) {
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
// 3. Create PEs and add these into an object of PowerPeList.
List<Pe> peList = new ArrayList<Pe>();
peList.add(new Pe(0, new PeProvisionerSimple(mips[i%mips.length]))); // need to store PowerPe id and MIPS Rating

// 4. Create PowerHost with its id and list of PEs and add them to the list of machines
hostList.add(
new PowerHost(
i,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList), 
new PowerModelLinear(maxPower, staticPowerPercent)
)
); // This is our machine
}
                
                

// 5. Create a DatacenterCharacteristics object that stores the
// properties of a Grid resource: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/PowerPe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this
// resource
double costPerBw = 0.0; // the cost of using bw in this resource

DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);

// 6. Finally, we need to create a PowerDatacenter object.
                PowerDatacenter datacenter = null;
try {
//RoundRobinVmAllocationPolicy vm_policy = new RoundRobinVmAllocationPolicy(hostList);
datacenter = new PowerDatacenter(name, 
characteristics,
new VmAllocationPolicySimple(hostList), 
storageList, 
0.5);
} catch (Exception e) {
}
return datacenter;
}

        public double getNumberOfHosts()
        { 
            
            System.out.println("hostNumber :"+ hostsNumber);
               
          return 0;
        }
        
        public List<PowerHost> getHostList() {
            return hostList;
}
                
      
   // public static double getHostCpuUtilization(PowerHost host) {
      //  double cpuUtilization = host.getAvailableMips();
      //  System.out.println("cpu................................"+cpuUtilization);
         //   return cpuUtilization;
   /// }
// submit vms and cloudlets according
// to the specific rules of the simulated scenario
/**
 * Creates the broker.
 *
 * @return the datacenter broker
 */
     
private static DatacenterBroker createBroker() {
DatacenterBroker broker = null;
try {
broker = new DatacenterBroker("Broker");
} catch (Exception e) {
return null;
}
return broker;
}

/**
 * Prints the Cloudlet objects.
 *
 * @param list list of Cloudlets
 */
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;

String indent = "\t";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent
+ "Resource ID" + indent + "VM ID" + indent + "Time" + indent
+ "Start Time" + indent + "Finish Time");

DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId());

if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
Log.printLine(indent + "SUCCESS"
+ indent + indent + cloudlet.getResourceId()
+ indent + cloudlet.getVmId()
+ indent + dft.format(cloudlet.getActualCPUTime())
+ indent + dft.format(cloudlet.getExecStartTime())
+ indent + indent + dft.format(cloudlet.getFinishTime())
);
                                
}
}
}


}

sir if possiblle then plz give suggestion what to do how to do .
I am really thankful to you if you can provide me any help possible
i am using cloudsim 3.0.3

Manoel Campos

unread,
Feb 8, 2016, 5:16:28 AM2/8/16
to clou...@googlegroups.com
Well, I finished studying CloudSim documentation and I saw there is a lot of different classes in the package org.cloudbus.cloudsim.power that determine host over utilization applying different methods.
You can start by seeing the abstract class PowerVmAllocationPolicyMigrationAbstract and its subclasses.
The method isHostOverUtilized in the subclasses applies different techniques to detect host overutilization.

See the other message I just posted about cloudsim documentation update and get the new cloudsim version.

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

Binal Parekh

unread,
Feb 8, 2016, 11:50:41 AM2/8/16
to clou...@googlegroups.com
thank you sir

cloudsim 3.0.3. is not latest version??

sir criteria for overutilization or under utilized host is decided but first i have to find host utilization but getUtilizationOfHost() is alwys return 0 
and if i use power datacenter start.simulation gave me nullpointerException 

Manoel Campos

unread,
Feb 8, 2016, 2:52:11 PM2/8/16
to clou...@googlegroups.com
I updated the entire cloudsim documentation. A pull request was merged today. 
The version may continue as 3.0.3, but the entire documentation has changed.
So, if you want more detailed documentation, is better to download cloudsim again
at the official git repository: https://github.com/Cloudslab/cloudsim

About the host utilization, see this example:

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 9, 2016, 9:03:39 AM2/9/16
to cloudsim
i used that latest version still i have the same  error ..

sir, how to use powerdatacenter is it true just replace our datacenter with powerdatacenter and powerhost 

because in my program if i use power datacenter then error generate and it terminate my simulation after some code run 

Manoel Campos

unread,
Feb 10, 2016, 11:03:34 AM2/10/16
to clou...@googlegroups.com
Probably you have to use PowerDataCenter, PowerHost and PowerVM. 
But I haven't worked with theses classes yet.

If you post the entire error stack trace, I can try to figure out what the problem is. 

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

--

Binal Parekh

unread,
Feb 10, 2016, 11:18:36 AM2/10/16
to clou...@googlegroups.com
yes sir ... i used that and finally i got results .. thank you soo much sir for your help



--

---
You received this message because you are subscribed to a topic in the Google Groups "cloudsim" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cloudsim/MVVXolbAgVc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cloudsim+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Manoel Campos

unread,
Feb 11, 2016, 8:33:06 AM2/11/16
to clou...@googlegroups.com
You're welcome.

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 11, 2016, 2:13:46 PM2/11/16
to clou...@googlegroups.com
sir i want to know

i am using powerdatacenter it directly gives host utilization in each every time frame 
i want to store that host utilization in particular array .. is it possible??

Manoel Campos

unread,
Feb 16, 2016, 5:44:20 AM2/16/16
to clou...@googlegroups.com
Well, if you navigate through the method calls using some IDE, you can see that, in fact, the time
is being ignored for the common used UtilizationModelFull class. The last call is to the method getUtilization of a class implementing the UtilizationModel interface.

An UtilizationModel object is used when instantiating a cloudlet, to define how it will use resources such as RAM, CPU or BW. The UtilizationModelFull assumes that the resource to it is assigned is being consumed 100% of its capacity all the time. So, assigning such an instance to the cloudlet CPU utilization, it will use all its CPU all the time. Thus, the time parameter of the method getUtilization of the UtilizationModel interface will be ignored for the UtilizationModelFull implementation.

Usually, you have to create a implementation of this interface to define your resource utilization model. The UtilizationModelPlanetLabInMemory class, for instance, uses a PlanetLab trace file to determine resource utilization. There, the time parameter is in fact being used.

Other implementations such as UtilizationModelStochastic, defines the resource usage randomly. 

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 23, 2016, 5:46:40 AM2/23/16
to clou...@googlegroups.com
300.10: [Host #4] utilization at 0.00 was 0.00%, now is 6.75%
under utilized host...[6.751558797246508]
300.10: [Host #4] energy is 0.00 W*sec

300.10: [Host #5] utilization at 0.00 was 0.00%, now is 6.94%
under utilized host...[6.941921885950228]
300.10: [Host #5] energy is 0.00 W*sec

300.10: [Host #6] utilization at 0.00 was 0.00%, now is 37.58%
under utilized host...[]
300.10: [Host #6] energy is 0.00 W*sec

300.10: [Host #7] utilization at 0.00 was 0.00%, now is 8.02%
under utilized host...[8.019334149642603]
300.10: [Host #7] energy is 0.00 W*sec

300.10: Data center's energy is 0.00 W*sec

.............................
java.lang.NullPointerException
at org.cloudbus.cloudsim.power.PowerDatacenter.updateCloudetProcessingWithoutSchedulingFutureEventsForce(PowerDatacenter.java:267)
at org.cloudbus.cloudsim.power.PowerDatacenter.updateCloudletProcessing(PowerDatacenter.java:106)
at org.cloudbus.cloudsim.Datacenter.processEvent(Datacenter.java:253)
at org.cloudbus.cloudsim.core.SimEntity.run(SimEntity.java:406)
at org.cloudbus.cloudsim.core.CloudSim.runClockTick(CloudSim.java:518)
at org.cloudbus.cloudsim.core.CloudSim.run(CloudSim.java:882)
at org.cloudbus.cloudsim.core.CloudSim.startSimulation(CloudSim.java:188)
at org.cloudbus.cloudsim.power.Csim_4.main(Csim_4.java:84)
Unwanted errors happen
My example finished!

m getting this type of error 

Manoel Campos

unread,
Feb 24, 2016, 5:11:02 AM2/24/16
to clou...@googlegroups.com
Follow the stack trace and discover the exact line of code of what method and class the error is occurring.
Post the code snippet here and tell from what method and class the error come that I try to help you.

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 24, 2016, 1:03:30 PM2/24/16
to clou...@googlegroups.com
thank you sir 

my goal is to minimize the working host maximize sleepy host using live migration for that migration i want cloudlet utilization on vm and host utilization at once place ..i making changes in powerdatacenter class when i will apply algo for migration.i make changes in power datacenter class but i give error null pointer exception 

protected void updateCloudletProcessing() {
if (getCloudletSubmitted() == -1 || getCloudletSubmitted() == CloudSim.clock()) {
CloudSim.cancelAll(getId(), new PredicateType(CloudSimTags.VM_DATACENTER_EVENT));
schedule(getId(), getSchedulingInterval(), CloudSimTags.VM_DATACENTER_EVENT);
return;
}
double currentTime = CloudSim.clock();

// if some time passed since last processing
if (currentTime > getLastProcessTime()) {
System.out.print(currentTime + " ");
List<Double> try1 = updateCloudetProcessingWithoutSchedulingFutureEventsForce();
for(PowerHost host:this.<PowerHost>getHostList())
{
if(currentTime>0)
{
utilizationOfCpu = host.getUtilizationOfCpu();
///int W= (100- (int)utilizationOfCpu);
Log.printLine("Host_utilization=["+utilizationOfCpu*100+"]"+"at host [#"+host.getId()+"]"+ "...at current time["+currentTime +"]");
//Log.printLine("W="+W);
if(utilizationOfCpu==0.0)
{
Log.printLine("0 utilizatio host has power=["+host.getEnergyLinearInterpolation(0,utilizationOfCpu , currentTime)+"]");
}
}
}
Log.printLine("cloudlet utilization"+Csim_4.cloudlet_utilization);
for(PowerHost host:this.<PowerHost>getHostList())
{
for(PowerVm vm:host.<PowerVm>getVmList())
{
double vm_utilization = vm.getTotalUtilizationOfCpu(currentTime);
Log.printLine("VM utilization@@@@@@["+vm_utilization+"]"+"at host[#"+host.getId()+"]");
Log.printLine("cloudlet submitted&["+vm.getCloudletScheduler()+"]"+"atVm[#"+vm.getId()+"]");
}
}
double Total_weight= 100.00;
Log.printLine("total number of Under_utilized host="+UnderHosts.size());
UnderHosts.sort();
}
}

Manoel Campos

unread,
Feb 24, 2016, 5:17:59 PM2/24/16
to clou...@googlegroups.com
I think we are using different versions of CloudSim, so I couldn't track the error.
You have to highlight the exact line in this code where the exception is thrown, so I can try to figure out the problem.

Manoel Campos da Silva Filho Professor and Software Engineer
manoel...@gmail.com | www.manoelcampos.com

Professor at Federal Institute of Education, Science and Technology of Tocantins - Brazil
Computer Science and Engineering PhD Student at University of Beira Interior - Portugal

 about.me

Binal Parekh

unread,
Feb 26, 2016, 1:46:15 AM2/26/16
to clou...@googlegroups.com
sir can you help me for vm migration from one host to another ?

Viswa nathan

unread,
Feb 26, 2016, 6:15:30 AM2/26/16
to cloudsim
Can any one pleases send me the code for using powerdatacenter powervm and powerhost

Viswa nathan

unread,
Feb 26, 2016, 6:16:58 AM2/26/16
to cloudsim
Whether we can just modify the vm host and datacenter as Powervm powerhost powerdataceter,,,
if we modify like this is it run without the error

Binal Parekh

unread,
Feb 29, 2016, 3:20:19 PM2/29/16
to clou...@googlegroups.com
here i am sending file which use power datacenter power host and power vm
Csim_4.txt
Reply all
Reply to author
Forward
0 new messages