当前位置: 首页>>代码示例>>Java>>正文


Java Log.printLine方法代码示例

本文整理汇总了Java中org.cloudbus.cloudsim.Log.printLine方法的典型用法代码示例。如果您正苦于以下问题:Java Log.printLine方法的具体用法?Java Log.printLine怎么用?Java Log.printLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.cloudbus.cloudsim.Log的用法示例。


在下文中一共展示了Log.printLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHostAddressByVmId

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
public int getHostAddressByVmId(int vmId) {
	Vm vm = findVm(vmId);
	if(vm == null) {
		Log.printLine(CloudSim.clock() + ": " + getName() + ": Cannot find VM with vmId = "+ vmId);
		return -1;
	}
	
	Host host = vm.getHost();
	SDNHost sdnhost = findSDNHost(host);
	if(sdnhost == null) {
		Log.printLine(CloudSim.clock() + ": " + getName() + ": Cannot find SDN Host with vmId = "+ vmId);
		return -1;
	}
	
	return sdnhost.getAddress();
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:17,代码来源:NetworkOperatingSystem.java

示例2: processCloudletReturn

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Process a cloudlet return event.
 * 
 * @param ev a SimEvent object
 * 
 * @pre ev != $null
 * @post $none
 */
protected void processCloudletReturn(SimEvent ev) {
	Cloudlet cloudlet = (Cloudlet) ev.getData();
	getCloudletReceivedList().add(cloudlet);
	cloudletsSubmitted--;
	// all cloudlets executed
	if (getCloudletList().size() == 0 && cloudletsSubmitted == 0 && NetworkConstants.iteration > 10) {
		Log.printLine(CloudSim.clock() + ": " + getName() + ": All Cloudlets executed. Finishing...");
		clearDatacenters();
		finishExecution();
	} else { // some cloudlets haven't finished yet
		if (getAppCloudletList().size() > 0 && cloudletsSubmitted == 0) {
			// all the cloudlets sent finished. It means that some bount
			// cloudlet is waiting its VM be created
			clearDatacenters();
			createVmsInDatacenterBase(0);
		}

	}
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:28,代码来源:NetDatacenterBroker.java

示例3: setStatusFailed

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Sets the status of PEs of this machine to FAILED. NOTE: <tt>resName</tt> and
 * <tt>machineID</tt> are used for debugging purposes, which is <b>ON</b> by default. Use
 * {@link #setStatusFailed(boolean)} if you do not want this information.
 * 
 * @param resName the name of the resource
 * @param hostId the id of this machine
 * @param failed the new value for the "failed" parameter
 */
public static <T extends Pe> void setStatusFailed(
		List<T> peList,
		String resName,
		int hostId,
		boolean failed) {
	String status = null;
	if (failed) {
		status = "FAILED";
	} else {
		status = "WORKING";
	}

	Log.printLine(resName + " - Machine: " + hostId + " is " + status);

	setStatusFailed(peList, failed);
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:26,代码来源:PeList.java

示例4: getNewVmPlacement

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Gets the new vm placement.
 * 
 * @param vmsToMigrate the vms to migrate
 * @param excludedHosts the excluded hosts
 * @return the new vm placement
 */
protected List<Map<String, Object>> getNewVmPlacement(
		List<? extends Vm> vmsToMigrate,
		Set<? extends Host> excludedHosts) {
	List<Map<String, Object>> migrationMap = new LinkedList<Map<String, Object>>();
	PowerVmList.sortByCpuUtilization(vmsToMigrate);
	for (Vm vm : vmsToMigrate) {
		PowerHost allocatedHost = findHostForVm(vm, excludedHosts);
		if (allocatedHost != null) {
			allocatedHost.vmCreate(vm);
			Log.printLine("VM #" + vm.getId() + " allocated to host #" + allocatedHost.getId());

			Map<String, Object> migrate = new HashMap<String, Object>();
			migrate.put("vm", vm);
			migrate.put("host", allocatedHost);
			migrationMap.add(migrate);
		}
	}
	return migrationMap;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:27,代码来源:PowerVmAllocationPolicyMigrationAbstract.java

示例5: startSimulation

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Starts the execution of CloudSim simulation. It waits for complete execution of all entities,
 * i.e. until all entities threads reach non-RUNNABLE state or there are no more events in the
 * future event queue.
 * <p>
 * <b>Note</b>: This method should be called after all the entities have been setup and added.
 * 
 * @return the double
 * @throws NullPointerException This happens when creating this entity before initialising
 *             CloudSim package or this entity name is <tt>null</tt> or empty.
 * @see gridsim.CloudSim#init(int, Calendar, boolean)
 * @pre $none
 * @post $none
 */
public static double startSimulation() throws NullPointerException {
	Log.printLine("Starting CloudSim version " + CLOUDSIM_VERSION_STRING);
	try {
		double clock = run();

		// reset all static variables
		cisId = -1;
		shutdownId = -1;
		cis = null;
		calendar = null;
		traceFlag = false;

		return clock;
	} catch (IllegalArgumentException e) {
		e.printStackTrace();
		throw new NullPointerException("CloudSim.startCloudSimulation() :"
				+ " Error - you haven't initialized CloudSim.");
	}
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:34,代码来源:CloudSim.java

示例6: printCloudlet

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
private static void printCloudlet(Cloudlet cloudlet) {
	Log.print(String.format(LogPrinter.fInt, cloudlet.getCloudletId()));

	if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
		Log.print(String.format(LogPrinter.fString, "SUCCESS"));
		Log.print(String.format(LogPrinter.fInt, cloudlet.getResourceId()));
		Log.print(String.format(LogPrinter.fInt, cloudlet.getVmId()));
		Log.print(String.format(LogPrinter.fInt, cloudlet.getCloudletLength()));
		Log.print(String.format(LogPrinter.fFloat, cloudlet.getActualCPUTime()));
		Log.print(String.format(LogPrinter.fFloat, cloudlet.getExecStartTime()));
		Log.print(String.format(LogPrinter.fFloat, cloudlet.getFinishTime()));
		Log.print("\n");
	}
	else {
		Log.printLine("FAILED");
	}
}
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:18,代码来源:LogPrinter.java

示例7: printCloudletList

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Prints the Cloudlet objects
 * @param list  list of Cloudlets
 */
private static void printCloudletList(List<Cloudlet> list) {
    int size = list.size();
    Cloudlet cloudlet;

    String indent = "    ";
    Log.printLine();
    Log.printLine("========== OUTPUT ==========");
    Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
            "Data center 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() + indent + indent);

        if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
            Log.print("SUCCESS");

        	Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
                 indent + indent + dft.format(cloudlet.getActualCPUTime()) + indent + indent + dft.format(cloudlet.getExecStartTime())+
                        indent + indent + dft.format(cloudlet.getFinishTime()));
        }
    }

}
 
开发者ID:marcbux,项目名称:dynamiccloudsim,代码行数:30,代码来源:CloudSimExample2.java

示例8: isFileValid

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Check if the file is valid or not. This method checks whether the given file or the file name of the file is
 * valid. The method name parameter is used for debugging purposes, to output in which method an error has occured.
 * 
 * @param file
 *            the file to be checked for validity
 * @param methodName
 *            the name of the method in which we check for validity of the file
 * @return <tt>true</tt> if the file is valid, <tt>false</tt> otherwise
 */
protected boolean isFileValid(File file, String methodName) { // Modified privacy for Baptiste Louis test

	if (file == null) {
		Log.printLine(name + "." + methodName + ": Warning - the given file is null.");
		return false;
	}

	String fileName = file.getName();
	if (fileName == null || fileName.length() == 0) {
		Log.printLine(name + "." + methodName + ": Warning - invalid file name.");
		return false;
	}

	return true;
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:26,代码来源:MyHarddriveStorage.java

示例9: init

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
@Override
protected void init(String inputFolder) {
	try {
		CloudSim.init(1, Calendar.getInstance(), false);

		broker = Helper.createBroker();
		int brokerId = broker.getId();

		cloudletList = PlanetLabHelper.createCloudletListPlanetLab(brokerId, inputFolder);
		vmList = Helper.createVmList(brokerId, cloudletList.size());
		hostList = Helper.createHostList(PlanetLabConstants.NUMBER_OF_HOSTS);
	} catch (Exception e) {
		e.printStackTrace();
		Log.printLine("The simulation has been terminated due to an unexpected error");
		System.exit(0);
	}
}
 
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:18,代码来源:PlanetLabRunner.java

示例10: printCloudletList

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
public static void printCloudletList(List<Cloudlet> list) {
	int size = list.size();
	Cloudlet cloudlet;

	Log.printLine();
	Log.printLine("========== OUTPUT ==========");
	
	Log.print(String.format(LogPrinter.fString, "Cloudlet_ID"));
	Log.print(String.format(LogPrinter.fString, "STATUS" ));
	Log.print(String.format(LogPrinter.fString, "DataCenter_ID"));
	Log.print(String.format(LogPrinter.fString, "VM_ID"));
	Log.print(String.format(LogPrinter.fString, "Length"));
	Log.print(String.format(LogPrinter.fString, "Time"));
	Log.print(String.format(LogPrinter.fString, "Start Time"));
	Log.print(String.format(LogPrinter.fString, "Finish Time"));
	Log.print("\n");

	//DecimalFormat dft = new DecimalFormat("######.##");
	for (int i = 0; i < size; i++) {
		cloudlet = list.get(i);
		printCloudlet(cloudlet);
	}
}
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:24,代码来源:LogPrinter.java

示例11: printCloudletList

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Prints the Cloudlet objects
 * @param list  list of Cloudlets
 */
private static void printCloudletList(List<Cloudlet> list) {
	int size = list.size();
	Cloudlet cloudlet;

	String indent = "    ";
	Log.printLine();
	Log.printLine("========== OUTPUT ==========");
	Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
			"Data center ID" + indent + "VM ID" + indent + 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() + indent + indent);

		if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
			Log.print("SUCCESS");

			Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
					indent + indent + indent + dft.format(cloudlet.getActualCPUTime()) +
					indent + indent + dft.format(cloudlet.getExecStartTime())+ indent + indent + indent + dft.format(cloudlet.getFinishTime()));
		}
	}

}
 
开发者ID:marcbux,项目名称:dynamiccloudsim,代码行数:30,代码来源:CloudSimExample8.java

示例12: initialize

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Initialise the simulation for stand alone simulations. This function should be called at the
 * start of the simulation.
 */
protected static void initialize() {
	Log.printLine("Initialising...");
	entities = new ArrayList<SimEntity>();
	entitiesByName = new LinkedHashMap<String, SimEntity>();
	future = new FutureQueue();
	deferred = new DeferredQueue();
	waitPredicates = new HashMap<Integer, Predicate>();
	clock = 0;
	running = false;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:15,代码来源:CloudSim.java

示例13: processResourceCharacteristicsRequest

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Process a request for the characteristics of a PowerDatacenter.
 * 
 * @param ev a SimEvent object
 * 
 * @pre ev != $null
 * @post $none
 */

protected void processResourceCharacteristicsRequest(SimEvent ev) {
	setDatacenterIdsList(CloudSim.getCloudResourceList());
	setDatacenterCharacteristicsList(new HashMap<Integer, DatacenterCharacteristics>());

	Log.printLine(CloudSim.clock() + ": " + getName() + ": Cloud Resource List received with "
			+ getDatacenterIdsList().size() + " resource(s)");

	for (Integer datacenterId : getDatacenterIdsList()) {
		sendNow(datacenterId, CloudSimTags.RESOURCE_CHARACTERISTICS, getId());
	}
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:21,代码来源:NetDatacenterBroker.java

示例14: optimizeAllocation

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Optimize allocation of the VMs according to current utilization.
 * 
 * @param vmList the vm list
 * 
 * @return the array list< hash map< string, object>>
 */
@Override
public List<Map<String, Object>> optimizeAllocation(List<? extends Vm> vmList) {
	ExecutionTimeMeasurer.start("optimizeAllocationTotal");

	ExecutionTimeMeasurer.start("optimizeAllocationHostSelection");
	List<PowerHostUtilizationHistory> overUtilizedHosts = getOverUtilizedHosts();
	getExecutionTimeHistoryHostSelection().add(
			ExecutionTimeMeasurer.end("optimizeAllocationHostSelection"));

	printOverUtilizedHosts(overUtilizedHosts);

	saveAllocation();

	ExecutionTimeMeasurer.start("optimizeAllocationVmSelection");
	List<? extends Vm> vmsToMigrate = getVmsToMigrateFromHosts(overUtilizedHosts);
	getExecutionTimeHistoryVmSelection().add(ExecutionTimeMeasurer.end("optimizeAllocationVmSelection"));

	Log.printLine("Reallocation of VMs from the over-utilized hosts:");
	ExecutionTimeMeasurer.start("optimizeAllocationVmReallocation");
	List<Map<String, Object>> migrationMap = getNewVmPlacement(vmsToMigrate, new HashSet<Host>(
			overUtilizedHosts));
	getExecutionTimeHistoryVmReallocation().add(
			ExecutionTimeMeasurer.end("optimizeAllocationVmReallocation"));
	Log.printLine();

	migrationMap.addAll(getMigrationMapFromUnderUtilizedHosts(overUtilizedHosts));

	restoreAllocation();

	getExecutionTimeHistoryTotal().add(ExecutionTimeMeasurer.end("optimizeAllocationTotal"));

	return migrationMap;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:41,代码来源:PowerVmAllocationPolicyMigrationAbstract.java

示例15: updatePackageProcessing

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Updates processing of transmissions taking place in this Channel.
 * @param currentTime current simulation time (in seconds)
 * @return delay to next transmission completion or
 *         Double.POSITIVE_INFINITY if there is no pending transmissions
 */
public boolean updatePackageProcessing(){
	double currentTime = CloudSim.clock();
	double timeSpent = NetworkOperatingSystem.round(currentTime - this.previousTime);
	
	if(timeSpent <= 0 || inTransmission.size() == 0)
		return false;	// Nothing changed

	//update the amount of transmission 
	long processedThisRound =  Math.round(timeSpent*getAllocatedBandwidthPerTransmission());
	
	//update transmission table; remove finished transmission
	LinkedList<Transmission> completedTransmissions = new LinkedList<Transmission>();
	for(Transmission transmission: inTransmission){
		transmission.addCompletedLength(processedThisRound);
		
		if (transmission.isCompleted()){
			completedTransmissions.add(transmission);
			this.completed.add(transmission);
		}	
	}
	
	this.inTransmission.removeAll(completedTransmissions);
	previousTime=currentTime;

	Log.printLine(CloudSim.clock() + ": Channel.updatePackageProcessing() ("+this.toString()+"):Time spent:"+timeSpent+
			", BW/host:"+getAllocatedBandwidthPerTransmission()+", Processed:"+processedThisRound);
	
	if(completedTransmissions.isEmpty())
		return false;	// Nothing changed
	return true;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:38,代码来源:Channel.java


注:本文中的org.cloudbus.cloudsim.Log.printLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。