CloudSim源码学习Cloudlet.docx
- 文档编号:2891716
- 上传时间:2022-11-16
- 格式:DOCX
- 页数:46
- 大小:27.99KB
CloudSim源码学习Cloudlet.docx
《CloudSim源码学习Cloudlet.docx》由会员分享,可在线阅读,更多相关《CloudSim源码学习Cloudlet.docx(46页珍藏版)》请在冰豆网上搜索。
CloudSim源码学习Cloudlet
/*
*Title:
CloudSimToolkit
*Description:
CloudSim(CloudSimulation)ToolkitforModelingandSimulationofClouds
*Licence:
GPL-http:
//www.gnu.org/copyleft/gpl.html
*
*Copyright(c)2009-2010,TheUniversityofMelbourne,Australia
*/
packageorg.cloudbus.cloudsim;
importjava.text.DecimalFormat;//小数的十进制的
importjava.util.ArrayList;//数组
importjava.util.LinkedList;//链接表
importjava.util.List;//java.util集合框架、遗留的collection类、事件模型、日期和时间设施、国际化和各种实用工具类
importorg.cloudbus.cloudsim.core.CloudSim;
/**
*Cloudletisanextensiontothecloudlet.Itstores,despitealltheinformation
*encapsulatedintheCloudlet,theIDoftheVMrunningit.
*
*@authorRodrigoN.Calheiros
*@authorAntonBeloglazov
*@sinceCloudSimToolkit1.0
*/
publicclassCloudlet{
//theUserorBrokerID.ItisadvisablethatbrokersetthisID
//withitsownID,sothatCloudResourcereturnstoitaftertheexecution
/**Theuserid.*///用户ID
privateintuserId;
//thesizeofthisCloudlettobeexecutedinaCloudResource(unit:
inMI)
/**Thecloudletlength.*///云任务长度单位:
MI
privatelongcloudletLength;
//theinputfilesizeofthisCloudletbeforeexecution(unit:
inbyte)
/**Thecloudletfilesize.*///云任务文件大小单位:
字节
privatefinallongcloudletFileSize;//inbyte=program+inputdatasize//字节=程序+输入数据大小
//theoutputfilesizeofthisCloudletafterexecution(unit:
inbyte)
/**Thecloudletoutputsize.*///云任务输出文件大小
privatefinallongcloudletOutputSize;
/**Thepesnumber.*///执行任务请求的PE数
privateintpesNumber;//numofPerequiredtoexecutethisjob
/**Thecloudletid.*///云任务ID
privatefinalintcloudletId;//thisCloudletID
/**Thestatus.*///云任务状态
privateintstatus;//statusofthisCloudlet
/**Thenum.*///十进制格式
privateDecimalFormatnum;//toformatthedecimalnumber
/**Thefinishtime.*///云任务完成时间
privatedoublefinishTime;//thetimewherethisCloudletcompletes
//starttimeofexecutingthisCloudlet.
//Withnewfunctionalities,suchasCANCEL,PAUSEDandRESUMED,this
//attributeonlystoresthelatestexecutiontime.Previousexecutiontime
//areignored.
/**Theexecstarttime.*///执行仿真开始时间
privatedoubleexecStartTime;//insimulationtime
/**Thereservationid.*///云任务预约ID资源的ID?
(预约资源)
privateintreservationId=-1;//theIDofareservationmadeforthiscloudlet
//recordsthetransactionhistoryforthisCloudlet//记录云任务的交易历史
/**Therecord.*///是否记录?
privatefinalbooleanrecord;//recordahistoryornot
/**Thenewline.*///换行?
privateStringnewline;
/**Thehistory.*///交易历史 String类是字符串常量,是不可更改的常量。
而StringBuffer是字符串变量,它的对象是可以扩充和修改的
privateStringBufferhistory;
/**Thereslist.*///资源列表?
privatefinalList
/**Theindex.*///索引
privateintindex;
//differentiatedservice不同的服务
/**Theclasstype.*///云任务类别
privateintclassType;//classtypeofCloudletforresourcescheduling
/**Thenettos.*///TOS(termsofservice)服务条款?
privateintnetToS;//ToSforsendingCloudletoverthenetwork
//私有访问控制符private只能被该类自身所访问和修改,而且不能被任何其他类(包括该类的子类)来获取和引用。
private修饰符用来声明那些类的私有成员,它提供了最高的保护级别
////////////////////////////////////////////
//BelowareCONSTANTSattributes以下是常量属性
/**TheCloudlethasbeencreatedandaddedtotheCloudletListobject.*/
publicstaticfinalintCREATED=0;//云任务创建并加入云任务列表对象
/**TheCloudlethasbeenassignedtoaCloudResourceobjectasplanned.*/
publicstaticfinalintREADY=1;//云任务按照计划分配给资源
/**TheCloudlethasmovedtoaCloudnode.*/
publicstaticfinalintQUEUED=2;//云任务提交给一个【云节点】虚拟机吗?
?
/**TheCloudletisinexecutioninaCloudnode.*/
publicstaticfinalintINEXEC=3;//云任务执行
/**TheCloudlethasbeenexecutedsuccessfully.*/
publicstaticfinalintSUCCESS=4;//云任务成功执行
/**TheCloudletisfailed.*/
publicstaticfinalintFAILED=5;//执行失败
/**TheCloudlethasbeencanceled.*/
publicstaticfinalintCANCELED=6;//云任务被取消
/**TheCloudlethasbeenpaused.ItcanberesumedbychangingthestatusintoRESUMED.*/
publicstaticfinalintPAUSED=7;//云任务执行暂停
/**TheCloudlethasbeenresumedfromPAUSEDstate.*/
publicstaticfinalintRESUMED=8;//重启执行云任务
/**Thecloudlethasfailedduetoaresourcefailure.*/
publicstaticfinalintFAILED_RESOURCE_UNAVAILABLE=9;//由于资源失败云任务失败
//公有访问控制符publicJava的类是通过包的概念来组织的,包是类的一个松散的集合。
具有了被其他包中的类访问的可能性,只要这些其他包中的类在程序中使用import语句引入public类,就可以访问和引用这个类
/**Thevmid.*///虚拟机编号
protectedintvmId;
/**Thecostperbw.*///带宽费用
protecteddoublecostPerBw;
/**Theaccumulatedbwcost.*///累计的带宽费用
protecteddoubleaccumulatedBwCost;
//protected被三种类所引用:
该类自身、与它在同一个包中的其它类、在其他包中的该类的子类。
使用protected修饰符的主要作用是允许其他包中该类的子类来访问父类的特定属性。
//Utilization【利用率】
/**Theutilizationofcpumodel.*///CPU利用模型
privateUtilizationM
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- CloudSim 源码 学习 Cloudlet
![提示](https://static.bdocx.com/images/bang_tan.gif)