├── .classpath
├── .gitignore
├── .project
├── LICENSE
├── README.md
├── out
└── production
│ └── .gitignore
└── src
├── executeTuple.png
├── executeTuple.useq
├── images
├── 1.gif
├── actuator.png
├── actuatorModule.png
├── dc.png
├── disk.png
├── edge.png
├── exit.png
├── hline.png
├── hline2.png
├── host.png
├── logo.png
├── module.png
├── openPhyTop.png
├── openVirTop.png
├── play.png
├── savePhyTop.png
├── saveVirTop.png
├── sensor.png
├── sensorModule.png
├── switch.png
├── upload1.png
├── upload2.png
├── upload3.png
├── upload4.png
├── vline.png
├── vline2.png
├── vline3.png
├── vline4.png
├── vm1.png
└── vm2.png
├── org
├── cloudbus
│ └── cloudsim
│ │ ├── Cloudlet.java
│ │ ├── CloudletScheduler.java
│ │ ├── CloudletSchedulerDynamicWorkload.java
│ │ ├── CloudletSchedulerSpaceShared.java
│ │ ├── CloudletSchedulerTimeShared.java
│ │ ├── Consts.java
│ │ ├── DataCloudTags.java
│ │ ├── Datacenter.java
│ │ ├── DatacenterBroker.java
│ │ ├── DatacenterCharacteristics.java
│ │ ├── File.java
│ │ ├── FileAttribute.java
│ │ ├── HarddriveStorage.java
│ │ ├── Host.java
│ │ ├── HostDynamicWorkload.java
│ │ ├── HostStateHistoryEntry.java
│ │ ├── InfoPacket.java
│ │ ├── Log.java
│ │ ├── NetworkTopology.java
│ │ ├── Packet.java
│ │ ├── ParameterException.java
│ │ ├── Pe.java
│ │ ├── ResCloudlet.java
│ │ ├── SanStorage.java
│ │ ├── Storage.java
│ │ ├── UtilizationModel.java
│ │ ├── UtilizationModelFull.java
│ │ ├── UtilizationModelNull.java
│ │ ├── UtilizationModelPlanetLabInMemory.java
│ │ ├── UtilizationModelStochastic.java
│ │ ├── Vm.java
│ │ ├── VmAllocationPolicy.java
│ │ ├── VmAllocationPolicySimple.java
│ │ ├── VmScheduler.java
│ │ ├── VmSchedulerSpaceShared.java
│ │ ├── VmSchedulerTimeShared.java
│ │ ├── VmSchedulerTimeSharedOverSubscription.java
│ │ ├── VmStateHistoryEntry.java
│ │ ├── core
│ │ ├── CloudInformationService.java
│ │ ├── CloudSim.java
│ │ ├── CloudSimShutdown.java
│ │ ├── CloudSimTags.java
│ │ ├── DeferredQueue.java
│ │ ├── FutureQueue.java
│ │ ├── SimEntity.java
│ │ ├── SimEvent.java
│ │ └── predicates
│ │ │ ├── Predicate.java
│ │ │ ├── PredicateAny.java
│ │ │ ├── PredicateFrom.java
│ │ │ ├── PredicateNone.java
│ │ │ ├── PredicateNotFrom.java
│ │ │ ├── PredicateNotType.java
│ │ │ └── PredicateType.java
│ │ ├── distributions
│ │ ├── ContinuousDistribution.java
│ │ ├── ExponentialDistr.java
│ │ ├── GammaDistr.java
│ │ ├── LognormalDistr.java
│ │ ├── LomaxDistribution.java
│ │ ├── ParetoDistr.java
│ │ ├── UniformDistr.java
│ │ ├── WeibullDistr.java
│ │ └── ZipfDistr.java
│ │ ├── lists
│ │ ├── CloudletList.java
│ │ ├── HostList.java
│ │ ├── PeList.java
│ │ ├── ResCloudletList.java
│ │ └── VmList.java
│ │ ├── network
│ │ ├── DelayMatrix_Float.java
│ │ ├── FloydWarshall_Float.java
│ │ ├── GraphReaderBrite.java
│ │ ├── GraphReaderIF.java
│ │ ├── TopologicalGraph.java
│ │ ├── TopologicalLink.java
│ │ ├── TopologicalNode.java
│ │ └── datacenter
│ │ │ ├── AggregateSwitch.java
│ │ │ ├── AppCloudlet.java
│ │ │ ├── EdgeSwitch.java
│ │ │ ├── HostPacket.java
│ │ │ ├── NetDatacenterBroker.java
│ │ │ ├── NetworkCloudlet.java
│ │ │ ├── NetworkCloudletSpaceSharedScheduler.java
│ │ │ ├── NetworkConstants.java
│ │ │ ├── NetworkDatacenter.java
│ │ │ ├── NetworkHost.java
│ │ │ ├── NetworkPacket.java
│ │ │ ├── NetworkVm.java
│ │ │ ├── NetworkVmAllocationPolicy.java
│ │ │ ├── RootSwitch.java
│ │ │ ├── Switch.java
│ │ │ ├── TaskStage.java
│ │ │ └── WorkflowApp.java
│ │ ├── power
│ │ ├── PowerDatacenter.java
│ │ ├── PowerDatacenterBroker.java
│ │ ├── PowerDatacenterNonPowerAware.java
│ │ ├── PowerHost.java
│ │ ├── PowerHostUtilizationHistory.java
│ │ ├── PowerVm.java
│ │ ├── PowerVmAllocationPolicyAbstract.java
│ │ ├── PowerVmAllocationPolicyMigrationAbstract.java
│ │ ├── PowerVmAllocationPolicyMigrationInterQuartileRange.java
│ │ ├── PowerVmAllocationPolicyMigrationLocalRegression.java
│ │ ├── PowerVmAllocationPolicyMigrationLocalRegressionRobust.java
│ │ ├── PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation.java
│ │ ├── PowerVmAllocationPolicyMigrationStaticThreshold.java
│ │ ├── PowerVmAllocationPolicySimple.java
│ │ ├── PowerVmSelectionPolicy.java
│ │ ├── PowerVmSelectionPolicyMaximumCorrelation.java
│ │ ├── PowerVmSelectionPolicyMinimumMigrationTime.java
│ │ ├── PowerVmSelectionPolicyMinimumUtilization.java
│ │ ├── PowerVmSelectionPolicyRandomSelection.java
│ │ ├── lists
│ │ │ └── PowerVmList.java
│ │ └── models
│ │ │ ├── PowerModel.java
│ │ │ ├── PowerModelCubic.java
│ │ │ ├── PowerModelLinear.java
│ │ │ ├── PowerModelSpecPower.java
│ │ │ ├── PowerModelSpecPowerHpProLiantMl110G3PentiumD930.java
│ │ │ ├── PowerModelSpecPowerHpProLiantMl110G4Xeon3040.java
│ │ │ ├── PowerModelSpecPowerHpProLiantMl110G5Xeon3075.java
│ │ │ ├── PowerModelSpecPowerIbmX3250XeonX3470.java
│ │ │ ├── PowerModelSpecPowerIbmX3250XeonX3480.java
│ │ │ ├── PowerModelSpecPowerIbmX3550XeonX5670.java
│ │ │ ├── PowerModelSpecPowerIbmX3550XeonX5675.java
│ │ │ ├── PowerModelSqrt.java
│ │ │ └── PowerModelSquare.java
│ │ ├── provisioners
│ │ ├── BwProvisioner.java
│ │ ├── BwProvisionerSimple.java
│ │ ├── PeProvisioner.java
│ │ ├── PeProvisionerSimple.java
│ │ ├── RamProvisioner.java
│ │ └── RamProvisionerSimple.java
│ │ ├── sdn
│ │ ├── Activity.java
│ │ ├── AggregationSwitch.java
│ │ ├── Arc.java
│ │ ├── Channel.java
│ │ ├── Constants.java
│ │ ├── CoreSwitch.java
│ │ ├── EdgeSwitch.java
│ │ ├── ForwardingRule.java
│ │ ├── Link.java
│ │ ├── Middlebox.java
│ │ ├── NetworkOperatingSystem.java
│ │ ├── Node.java
│ │ ├── Package.java
│ │ ├── PhysicalTopology.java
│ │ ├── Processing.java
│ │ ├── Request.java
│ │ ├── RoutingTable.java
│ │ ├── SDNDatacenter.java
│ │ ├── SDNHost.java
│ │ ├── Switch.java
│ │ ├── TimedVm.java
│ │ ├── Transmission.java
│ │ ├── example
│ │ │ ├── LogPrinter.java
│ │ │ ├── SDNBroker.java
│ │ │ ├── SDNExample.java
│ │ │ ├── SimpleNetworkOperatingSystem.java
│ │ │ ├── VmAllocationPolicyCombinedLeastFullFirst.java
│ │ │ ├── VmAllocationPolicyCombinedMostFullFirst.java
│ │ │ ├── VmAllocationPolicyMipsLeastFullFirst.java
│ │ │ ├── VmAllocationPolicyMipsMostFullFirst.java
│ │ │ ├── VmSchedulerSpaceSharedEnergy.java
│ │ │ ├── Workload.java
│ │ │ ├── WorkloadParser.java
│ │ │ ├── policies
│ │ │ │ ├── VmAllocationPolicyCombinedLeastFullFirst.java
│ │ │ │ ├── VmAllocationPolicyCombinedMostFullFirst.java
│ │ │ │ ├── VmAllocationPolicyMipsLeastFullFirst.java
│ │ │ │ ├── VmAllocationPolicyMipsMostFullFirst.java
│ │ │ │ └── VmSchedulerTimeSharedEnergy.java
│ │ │ └── topogenerators
│ │ │ │ ├── PhysicalTopologyGenerator.java
│ │ │ │ ├── VMRequestRandomGenerator.java
│ │ │ │ ├── VirtualTopologyGenerator.java
│ │ │ │ └── VirtualTopologyGeneratorVmTypes.java
│ │ ├── graph
│ │ │ ├── core
│ │ │ │ ├── Bridge.java
│ │ │ │ ├── Coordinates.java
│ │ │ │ ├── Edge.java
│ │ │ │ ├── Graph.java
│ │ │ │ ├── GraphView.java
│ │ │ │ ├── HostNode.java
│ │ │ │ ├── Node.java
│ │ │ │ ├── NodeCellRenderer.java
│ │ │ │ ├── SpringUtilities.java
│ │ │ │ ├── SwitchNode.java
│ │ │ │ └── VmNode.java
│ │ │ ├── dialog
│ │ │ │ ├── About.java
│ │ │ │ ├── AddPhysicalEdge.java
│ │ │ │ ├── AddPhysicalNode.java
│ │ │ │ ├── AddVirtualEdge.java
│ │ │ │ ├── AddVirtualNode.java
│ │ │ │ └── SDNRun.java
│ │ │ └── example
│ │ │ │ ├── GraphicSDN.java
│ │ │ │ └── GraphicSDNExample.java
│ │ ├── overbooking
│ │ │ ├── BwProvisionerOverbooking.java
│ │ │ ├── OverbookingNetworkOperatingSystem.java
│ │ │ ├── PeProvisionerOverbooking.java
│ │ │ ├── VmAllocationPolicyOverbooking.java
│ │ │ └── VmSchedulerTimeSharedOverbookingEnergy.java
│ │ ├── power
│ │ │ ├── PowerUtilizationHistoryEntry.java
│ │ │ ├── PowerUtilizationInterface.java
│ │ │ └── PowerUtilizationMaxHostInterface.java
│ │ └── request
│ │ │ └── VMRequestGenerator.java
│ │ └── util
│ │ ├── Check.java
│ │ ├── ExecutionTimeMeasurer.java
│ │ ├── MathUtil.java
│ │ ├── Test.java
│ │ ├── Test2.java
│ │ ├── WorkloadFileReader.java
│ │ └── WorkloadModel.java
└── fog
│ ├── application
│ ├── AppEdge.java
│ ├── AppLoop.java
│ ├── AppModule.java
│ ├── Application.java
│ ├── DAG.java
│ └── selectivity
│ │ ├── BurstySelectivity.java
│ │ ├── FractionalSelectivity.java
│ │ └── SelectivityModel.java
│ ├── entities
│ ├── Actuator.java
│ ├── ControllerComponent.java
│ ├── FogBroker.java
│ ├── FogDevice.java
│ ├── FogDeviceCharacteristics.java
│ ├── LoadBalancer.java
│ ├── ManagementTuple.java
│ ├── MicroserviceFogDevice.java
│ ├── PhysicalTopology.java
│ ├── PlacementRequest.java
│ ├── RRLoadBalancer.java
│ ├── Sensor.java
│ └── Tuple.java
│ ├── gui
│ ├── core
│ │ ├── ActuatorGui.java
│ │ ├── ActuatorModule.java
│ │ ├── AppModule.java
│ │ ├── Bridge.java
│ │ ├── Coordinates.java
│ │ ├── Edge.java
│ │ ├── FogDeviceGui.java
│ │ ├── Graph.java
│ │ ├── GraphView.java
│ │ ├── HostNode.java
│ │ ├── Link.java
│ │ ├── Node.java
│ │ ├── NodeCellRenderer.java
│ │ ├── PlaceHolder.java
│ │ ├── SensorGui.java
│ │ ├── SensorModule.java
│ │ ├── SpringUtilities.java
│ │ ├── SwitchNode.java
│ │ └── VmNode.java
│ ├── dialog
│ │ ├── About.java
│ │ ├── AddActuator.java
│ │ ├── AddActuatorModule.java
│ │ ├── AddAppEdge.java
│ │ ├── AddApplicationModule.java
│ │ ├── AddFogDevice.java
│ │ ├── AddLink.java
│ │ ├── AddPhysicalEdge.java
│ │ ├── AddPhysicalNode.java
│ │ ├── AddSensor.java
│ │ ├── AddSensorModule.java
│ │ ├── AddVirtualEdge.java
│ │ ├── AddVirtualNode.java
│ │ └── SDNRun.java
│ └── example
│ │ └── FogGui.java
│ ├── mobilitydata
│ ├── Clustering.java
│ ├── DataParser.java
│ ├── Location.java
│ ├── Polygon2D.java
│ ├── RandomMobilityGenerator.java
│ └── References.java
│ ├── placement
│ ├── ClusteredMicroservicePlacementLogic.java
│ ├── ClusteringController.java
│ ├── Controller.java
│ ├── DistributedMicroservicePlacementLogic.java
│ ├── LocationHandler.java
│ ├── MicroservicePlacementLogic.java
│ ├── MicroservicesController.java
│ ├── MicroservicesMobilityClusteringController.java
│ ├── MobilityController.java
│ ├── ModuleMapping.java
│ ├── ModulePlacement.java
│ ├── ModulePlacementEdgewards.java
│ ├── ModulePlacementMapping.java
│ ├── ModulePlacementMobileEdgewards.java
│ ├── ModulePlacementMobileEdgewardsCluster.java
│ ├── ModulePlacementOnlyCloud.java
│ ├── PlacementLogicFactory.java
│ └── PlacementLogicOutput.java
│ ├── policy
│ └── AppModuleAllocationPolicy.java
│ ├── scheduler
│ ├── StreamOperatorScheduler.java
│ └── TupleScheduler.java
│ ├── serverless
│ ├── application
│ │ ├── FogFaaSAppEdge.java
│ │ ├── FogFaaSAppLoop.java
│ │ ├── FogFaaSAppModule.java
│ │ └── FogFaaSApplication.java
│ ├── entities
│ │ ├── FogFaaSActuator.java
│ │ ├── FogFaaSBroker.java
│ │ ├── FogFaaSDevice.java
│ │ ├── FogFaaSSensor.java
│ │ └── FogFaaSTuple.java
│ ├── examples
│ │ ├── DCNS_FogFaaS.java
│ │ ├── Real_trace_test2_small.csv
│ │ └── VRGame_FogFaaS.java
│ ├── faas
│ │ ├── FogFaaSContainer.java
│ │ ├── FogFaaSFunction.java
│ │ ├── FogFaaSInvoker.java
│ │ ├── FogFaaSRequest.java
│ │ └── FogFaaSUtilizationModelPartial.java
│ ├── placement
│ │ ├── FogFaaSContainerRamProvisioner.java
│ │ ├── FogFaaSController.java
│ │ ├── FogFaaSModuleMapping.java
│ │ ├── FogFaaSModulePlacement.java
│ │ ├── FogFaaSModulePlacementEdgewards.java
│ │ ├── FogFaaSModulePlacementMapping.java
│ │ └── FogFaaSModulePlacementMobileEdgewards.java
│ ├── scheduler
│ │ ├── FogFaaSContainerScheduler.java
│ │ ├── FogFaaSFunctionScheduler.java
│ │ └── FogFaaSRequestScheduler.java
│ └── utils
│ │ ├── Constants.java
│ │ ├── FogFaaSTags.java
│ │ └── FogFaaSTimeKeeper.java
│ ├── test
│ ├── CleanFromJson.java
│ └── perfeval
│ │ ├── ApplicationConfig.json
│ │ ├── CardiovascularHealthMonitoringApplication.java
│ │ ├── CardiovascularHealthMonitoringApplicationEdgeward.java
│ │ ├── CrowdSensing_Microservices_RandomMobility_Clustering.java
│ │ ├── DCNSFog.java
│ │ ├── MicroserviceAppSample2.java
│ │ ├── MicroserviceApp_RandomMobility_Clustering.java
│ │ ├── MicroservicesAppSample1.java
│ │ ├── TranslationServiceFog.java
│ │ ├── TranslationServiceFog_Clustering.java
│ │ ├── TranslationServiceFog_RandomMobility.java
│ │ ├── TranslationServiceFog_RandomMobility_Clustering.java
│ │ ├── TwoApps.java
│ │ └── VRGameFog.java
│ └── utils
│ ├── CanBeSentResult.java
│ ├── Config.java
│ ├── FogEntityFactory.java
│ ├── FogEvents.java
│ ├── FogLinearPowerModel.java
│ ├── FogUtils.java
│ ├── GeoCoverage.java
│ ├── GeoLocation.java
│ ├── JsonToTopology.java
│ ├── Logger.java
│ ├── MicroservicePlacementConfig.java
│ ├── MigrationDelayMonitor.java
│ ├── ModuleLaunchConfig.java
│ ├── NetworkUsageMonitor.java
│ ├── OperatorEdge.java
│ ├── OperatorSetComparator.java
│ ├── ResourceUsageDetails.java
│ ├── ShortestPathRoutingGenerator.java
│ ├── TimeKeeper.java
│ ├── TupleFinishDetails.java
│ └── distribution
│ ├── DeterministicDistribution.java
│ ├── Distribution.java
│ ├── NormalDistribution.java
│ └── UniformDistribution.java
└── topologies
└── routerTopology
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 | replay_pid*
25 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | FoGFaaS
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/out/production/.gitignore:
--------------------------------------------------------------------------------
1 | /iFogSim2/
2 |
--------------------------------------------------------------------------------
/src/executeTuple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/executeTuple.png
--------------------------------------------------------------------------------
/src/executeTuple.useq:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/images/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/1.gif
--------------------------------------------------------------------------------
/src/images/actuator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/actuator.png
--------------------------------------------------------------------------------
/src/images/actuatorModule.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/actuatorModule.png
--------------------------------------------------------------------------------
/src/images/dc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/dc.png
--------------------------------------------------------------------------------
/src/images/disk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/disk.png
--------------------------------------------------------------------------------
/src/images/edge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/edge.png
--------------------------------------------------------------------------------
/src/images/exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/exit.png
--------------------------------------------------------------------------------
/src/images/hline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/hline.png
--------------------------------------------------------------------------------
/src/images/hline2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/hline2.png
--------------------------------------------------------------------------------
/src/images/host.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/host.png
--------------------------------------------------------------------------------
/src/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/logo.png
--------------------------------------------------------------------------------
/src/images/module.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/module.png
--------------------------------------------------------------------------------
/src/images/openPhyTop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/openPhyTop.png
--------------------------------------------------------------------------------
/src/images/openVirTop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/openVirTop.png
--------------------------------------------------------------------------------
/src/images/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/play.png
--------------------------------------------------------------------------------
/src/images/savePhyTop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/savePhyTop.png
--------------------------------------------------------------------------------
/src/images/saveVirTop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/saveVirTop.png
--------------------------------------------------------------------------------
/src/images/sensor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/sensor.png
--------------------------------------------------------------------------------
/src/images/sensorModule.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/sensorModule.png
--------------------------------------------------------------------------------
/src/images/switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/switch.png
--------------------------------------------------------------------------------
/src/images/upload1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/upload1.png
--------------------------------------------------------------------------------
/src/images/upload2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/upload2.png
--------------------------------------------------------------------------------
/src/images/upload3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/upload3.png
--------------------------------------------------------------------------------
/src/images/upload4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/upload4.png
--------------------------------------------------------------------------------
/src/images/vline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/vline.png
--------------------------------------------------------------------------------
/src/images/vline2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/vline2.png
--------------------------------------------------------------------------------
/src/images/vline3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/vline3.png
--------------------------------------------------------------------------------
/src/images/vline4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/vline4.png
--------------------------------------------------------------------------------
/src/images/vm1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/vm1.png
--------------------------------------------------------------------------------
/src/images/vm2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ParallelProcessingLab/fogfaas/bb8be9074de619093f0b5e5788e50ec6ef2a8c85/src/images/vm2.png
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/Consts.java:
--------------------------------------------------------------------------------
1 | package org.cloudbus.cloudsim;
2 |
3 | /**
4 | *
5 | * Defines common constants, used throughout cloudsim.
6 | *
7 | * @author nikolay.grozev
8 | *
9 | */
10 | public final class Consts {
11 |
12 | /**
13 | * Suppreses intantiation.
14 | */
15 | private Consts(){}
16 |
17 | public static int MILLION = 1000000;
18 | }
19 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/ParameterException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ** Network and Service Differentiation Extensions to CloudSim 3.0 **
3 | *
4 | * Gokul Poduval & Chen-Khong Tham
5 | * Computer Communication Networks (CCN) Lab
6 | * Dept of Electrical & Computer Engineering
7 | * National University of Singapore
8 | * October 2004
9 | *
10 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
11 | * Copyright (c) 2004, The University of Melbourne, Australia and
12 | * National University of Singapore
13 | * ParameterException.java - Thrown for illegal parameters
14 | *
15 | */
16 |
17 | package org.cloudbus.cloudsim;
18 |
19 | /**
20 | * This exception is to report bad or invalid parameters given during constructor.
21 | *
22 | * @author Gokul Poduval
23 | * @author Chen-Khong Tham, National University of Singapore
24 | * @since CloudSim Toolkit 1.0
25 | */
26 | public class ParameterException extends Exception {
27 |
28 | /** The Constant serialVersionUID. */
29 | private static final long serialVersionUID = 1L;
30 |
31 | /** The message. */
32 | private final String message;
33 |
34 | /**
35 | * Constructs a new exception with null as its detail message.
36 | *
37 | * @pre $none
38 | * @post $none
39 | */
40 | public ParameterException() {
41 | super();
42 | message = null;
43 | }
44 |
45 | /**
46 | * Creates a new ParameterException object.
47 | *
48 | * @param message an error message
49 | * @pre $none
50 | * @post $none
51 | */
52 | public ParameterException(String message) {
53 | super();
54 | this.message = message;
55 | }
56 |
57 | /**
58 | * Returns an error message of this object.
59 | *
60 | * @return an error message
61 | * @pre $none
62 | * @post $none
63 | */
64 | @Override
65 | public String toString() {
66 | return message;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/UtilizationModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim;
10 |
11 | /**
12 | * The UtilizationModel interface needs to be implemented in order to provide a fine-grained control
13 | * over resource usage by a Cloudlet.
14 | *
15 | * @author Anton Beloglazov
16 | * @since CloudSim Toolkit 2.0
17 | */
18 | public interface UtilizationModel {
19 |
20 | /**
21 | * Returns utilization in percents according to the time.
22 | *
23 | * @param time the time
24 | * @return utilization percentage
25 | */
26 | double getUtilization(double time);
27 |
28 | }
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/UtilizationModelFull.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim;
10 |
11 | /**
12 | * The UtilizationModelFull class is a simple model, according to which a Cloudlet always utilize
13 | * all the available CPU capacity.
14 | *
15 | * @author Anton Beloglazov
16 | * @since CloudSim Toolkit 2.0
17 | */
18 | public class UtilizationModelFull implements UtilizationModel {
19 |
20 | /*
21 | * (non-Javadoc)
22 | * @see cloudsim.power.UtilizationModel#getUtilization(double)
23 | */
24 | @Override
25 | public double getUtilization(double time) {
26 | return 1;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/UtilizationModelNull.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim;
10 |
11 | /**
12 | * The UtilizationModelNull class is a simple model, according to which a Cloudlet always require
13 | * zero capacity.
14 | *
15 | * @author Anton Beloglazov
16 | * @since CloudSim Toolkit 2.0
17 | */
18 | public class UtilizationModelNull implements UtilizationModel {
19 |
20 | /*
21 | * (non-Javadoc)
22 | * @see cloudsim.power.UtilizationModel#getUtilization(double)
23 | */
24 | @Override
25 | public double getUtilization(double time) {
26 | return 0;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/DeferredQueue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core;
10 |
11 | import java.util.Iterator;
12 | import java.util.LinkedList;
13 | import java.util.List;
14 | import java.util.ListIterator;
15 |
16 | /**
17 | * This class implements the deferred event queue used by {@link Simulation}. The event queue uses a
18 | * linked list to store the events.
19 | *
20 | * @author Marcos Dias de Assuncao
21 | * @since CloudSim Toolkit 1.0
22 | * @see Simulation
23 | * @see SimEvent
24 | */
25 | public class DeferredQueue {
26 |
27 | /** The list. */
28 | private final List list = new LinkedList();
29 |
30 | /** The max time. */
31 | private double maxTime = -1;
32 |
33 | /**
34 | * Adds a new event to the queue. Adding a new event to the queue preserves the temporal order
35 | * of the events.
36 | *
37 | * @param newEvent The event to be added to the queue.
38 | */
39 | public void addEvent(SimEvent newEvent) {
40 | // The event has to be inserted as the last of all events
41 | // with the same event_time(). Yes, this matters.
42 | double eventTime = newEvent.eventTime();
43 | if (eventTime >= maxTime) {
44 | list.add(newEvent);
45 | maxTime = eventTime;
46 | return;
47 | }
48 |
49 | ListIterator iterator = list.listIterator();
50 | SimEvent event;
51 | while (iterator.hasNext()) {
52 | event = iterator.next();
53 | if (event.eventTime() > eventTime) {
54 | iterator.previous();
55 | iterator.add(newEvent);
56 | return;
57 | }
58 | }
59 |
60 | list.add(newEvent);
61 | }
62 |
63 | /**
64 | * Returns an iterator to the events in the queue.
65 | *
66 | * @return the iterator
67 | */
68 | public Iterator iterator() {
69 | return list.iterator();
70 | }
71 |
72 | /**
73 | * Returns the size of this event queue.
74 | *
75 | * @return the number of events in the queue.
76 | */
77 | public int size() {
78 | return list.size();
79 | }
80 |
81 | /**
82 | * Clears the queue.
83 | */
84 | public void clear() {
85 | list.clear();
86 | }
87 |
88 | }
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/FutureQueue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core;
10 |
11 | import java.util.Collection;
12 | import java.util.Iterator;
13 | import java.util.SortedSet;
14 | import java.util.TreeSet;
15 |
16 | /**
17 | * This class implements the future event queue used by {@link Simulation}. The event queue uses a
18 | * {@link TreeSet} in order to store the events.
19 | *
20 | * @author Marcos Dias de Assuncao
21 | * @since CloudSim Toolkit 1.0
22 | * @see Simulation
23 | * @see java.util.TreeSet
24 | */
25 | public class FutureQueue {
26 |
27 | /** The sorted set. */
28 | private final SortedSet sortedSet = new TreeSet();
29 |
30 | /** The serial. */
31 | private long serial = 0;
32 |
33 | /**
34 | * Add a new event to the queue. Adding a new event to the queue preserves the temporal order of
35 | * the events in the queue.
36 | *
37 | * @param newEvent The event to be put in the queue.
38 | */
39 | public void addEvent(SimEvent newEvent) {
40 | newEvent.setSerial(serial++);
41 | sortedSet.add(newEvent);
42 | }
43 |
44 | /**
45 | * Add a new event to the head of the queue.
46 | *
47 | * @param newEvent The event to be put in the queue.
48 | */
49 | public void addEventFirst(SimEvent newEvent) {
50 | newEvent.setSerial(0);
51 | sortedSet.add(newEvent);
52 | }
53 |
54 | /**
55 | * Returns an iterator to the queue.
56 | *
57 | * @return the iterator
58 | */
59 | public Iterator iterator() {
60 | return sortedSet.iterator();
61 | }
62 |
63 | /**
64 | * Returns the size of this event queue.
65 | *
66 | * @return the size
67 | */
68 | public int size() {
69 | return sortedSet.size();
70 | }
71 |
72 | /**
73 | * Removes the event from the queue.
74 | *
75 | * @param event the event
76 | * @return true, if successful
77 | */
78 | public boolean remove(SimEvent event) {
79 | return sortedSet.remove(event);
80 | }
81 |
82 | /**
83 | * Removes all the events from the queue.
84 | *
85 | * @param events the events
86 | * @return true, if successful
87 | */
88 | public boolean removeAll(Collection events) {
89 | return sortedSet.removeAll(events);
90 | }
91 |
92 | /**
93 | * Clears the queue.
94 | */
95 | public void clear() {
96 | sortedSet.clear();
97 | }
98 |
99 | }
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/Predicate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * Predicates are used to select events from the deferred queue. This class is abstract and must be
15 | * extended when writing a new predicate. Some standard predicates are provided.
16 | * The idea of simulation predicates was copied from SimJava 2.
17 | *
18 | * @author Marcos Dias de Assuncao
19 | * @since CloudSim Toolkit 1.0
20 | * @see PredicateType
21 | * @see PredicateFrom
22 | * @see PredicateAny
23 | * @see PredicateNone
24 | * @see Simulation
25 | */
26 | public abstract class Predicate {
27 |
28 | /**
29 | * The match function which must be overridden when writing a new predicate. The function is
30 | * called with each event in the deferred queue as its parameter when a
31 | * Simulation.select()
call is made by the user.
32 | *
33 | * @param event The event to test for a match.
34 | * @return The function should return true
if the event matches and should be
35 | * selected, or false
if it does not match the predicate.
36 | */
37 | public abstract boolean match(SimEvent event);
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/PredicateAny.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * A predicate which will match any event on the deferred event queue. There is a publicly
15 | * accessible instance of this predicate in Simulation
, called
16 | * Simulation.SIM_ANY
, so no new instances need to be created.
17 | * The idea of simulation predicates was copied from SimJava 2.
18 | *
19 | * @author Marcos Dias de Assuncao
20 | * @since CloudSim Toolkit 1.0
21 | * @see Predicate
22 | * @see Simulation
23 | */
24 | public class PredicateAny extends Predicate {
25 |
26 | /**
27 | * The match function called by Simulation
, not used directly by the user.
28 | *
29 | * @param ev the ev
30 | * @return true, if match
31 | */
32 | @Override
33 | public boolean match(SimEvent ev) {
34 | return true;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/PredicateFrom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * A predicate which selects events from specific entities.
15 | * The idea of simulation predicates was copied from SimJava 2.
16 | *
17 | * @author Marcos Dias de Assuncao
18 | * @since CloudSim Toolkit 1.0
19 | * @see PredicateNotFrom
20 | * @see Predicate
21 | */
22 | public class PredicateFrom extends Predicate {
23 |
24 | /** The ids. */
25 | private final int[] ids;
26 |
27 | /**
28 | * Constructor used to select events that were sent by a specific entity.
29 | *
30 | * @param sourceId the id number of the source entity
31 | */
32 | public PredicateFrom(int sourceId) {
33 | ids = new int[] { sourceId };
34 | }
35 |
36 | /**
37 | * Constructor used to select events that were sent by any entity from a given set.
38 | *
39 | * @param sourceIds the set of id numbers of the source entities
40 | */
41 | public PredicateFrom(int[] sourceIds) {
42 | ids = sourceIds.clone();
43 | }
44 |
45 | /**
46 | * The match function called by Simulation
, not used directly by the user.
47 | *
48 | * @param ev the event to check
49 | * @return true
if the event matches the predicate, false
otherwise
50 | */
51 | @Override
52 | public boolean match(SimEvent ev) {
53 | int src = ev.getSource();
54 | for (int id : ids) {
55 | if (src == id) {
56 | return true;
57 | }
58 | }
59 | return false;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/PredicateNone.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * A predicate which will not match any event on the deferred event queue. There is a
15 | * publicly accessible instance of this predicate in the {@link Simulation} class, called
16 | * {@link Simulation#SIM_NONE}, so the user does not need to create any new instances. The idea of
17 | * simulation predicates was copied from SimJava 2.
18 | *
19 | * @author Marcos Dias de Assuncao
20 | * @since CloudSim Toolkit 1.0
21 | * @see Predicate
22 | * @see Simulation
23 | */
24 | public class PredicateNone extends Predicate {
25 |
26 | /**
27 | * The match function called by {@link Simulation}, not used directly by the user.
28 | *
29 | * @param ev the event to check
30 | * @return true
if the event matches the predicate, false
otherwise
31 | */
32 | @Override
33 | public boolean match(SimEvent ev) {
34 | return false;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/PredicateNotFrom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * A predicate which selects events that have not been sent by specific entities.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | * @see PredicateFrom
19 | * @see Predicate
20 | */
21 | public class PredicateNotFrom extends Predicate {
22 |
23 | /** The ids. */
24 | private final int[] ids;
25 |
26 | /**
27 | * Constructor used to select events that were not sent by a specific entity.
28 | *
29 | * @param sourceId the id number of the source entity
30 | */
31 | public PredicateNotFrom(int sourceId) {
32 | ids = new int[] { sourceId };
33 | }
34 |
35 | /**
36 | * Constructor used to select events that were not sent by any entity from a given set.
37 | *
38 | * @param sourceIds the set of id numbers of the source entities
39 | */
40 | public PredicateNotFrom(int[] sourceIds) {
41 | ids = sourceIds.clone();
42 | }
43 |
44 | /**
45 | * The match function called by {@link Simulation}, not used directly by the user.
46 | *
47 | * @param ev the event to check
48 | * @return true
if the event matches the predicate, false
otherwise
49 | */
50 | @Override
51 | public boolean match(SimEvent ev) {
52 | int src = ev.getSource();
53 | for (int id : ids) {
54 | if (src == id) {
55 | return false;
56 | }
57 | }
58 | return true;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/PredicateNotType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * A predicate to select events that don't match specific tags.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | * @see PredicateType
19 | * @see Predicate
20 | */
21 | public class PredicateNotType extends Predicate {
22 |
23 | /** The tags. */
24 | private final int[] tags;
25 |
26 | /**
27 | * Constructor used to select events whose tags do not match a given tag.
28 | *
29 | * @param tag An event tag value
30 | */
31 | public PredicateNotType(int tag) {
32 | tags = new int[] { tag };
33 | }
34 |
35 | /**
36 | * Constructor used to select events whose tag values do not match any of the given tags.
37 | *
38 | * @param tags the list of tags
39 | */
40 | public PredicateNotType(int[] tags) {
41 | this.tags = tags.clone();
42 | }
43 |
44 | /**
45 | * The match function called by {@link Simulation}, not used directly by the user.
46 | *
47 | * @param ev the ev
48 | * @return true, if match
49 | */
50 | @Override
51 | public boolean match(SimEvent ev) {
52 | int tag = ev.getTag();
53 | for (int tag2 : tags) {
54 | if (tag == tag2) {
55 | return false;
56 | }
57 | }
58 | return true;
59 | }
60 |
61 | }
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/core/predicates/PredicateType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.core.predicates;
10 |
11 | import org.cloudbus.cloudsim.core.SimEvent;
12 |
13 | /**
14 | * A predicate to select events with specific tags.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | * @see PredicateNotType
19 | * @see Predicate
20 | */
21 | public class PredicateType extends Predicate {
22 |
23 | /** The tags. */
24 | private final int[] tags;
25 |
26 | /**
27 | * Constructor used to select events with the tag value t1
.
28 | *
29 | * @param t1 an event tag value
30 | */
31 | public PredicateType(int t1) {
32 | tags = new int[] { t1 };
33 | }
34 |
35 | /**
36 | * Constructor used to select events with a tag value equal to any of the specified tags.
37 | *
38 | * @param tags the list of tags
39 | */
40 | public PredicateType(int[] tags) {
41 | this.tags = tags.clone();
42 | }
43 |
44 | /**
45 | * The match function called by Sim_system
, not used directly by the user.
46 | *
47 | * @param ev the ev
48 | * @return true, if match
49 | */
50 | @Override
51 | public boolean match(SimEvent ev) {
52 | int tag = ev.getTag();
53 | for (int tag2 : tags) {
54 | if (tag == tag2) {
55 | return true;
56 | }
57 | }
58 | return false;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/ContinuousDistribution.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.distributions;
10 |
11 | /**
12 | * Interface to be implemented by a random number generator.
13 | *
14 | * @author Marcos Dias de Assuncao
15 | * @since CloudSim Toolkit 1.0
16 | */
17 | public interface ContinuousDistribution {
18 |
19 | /**
20 | * Sample the random number generator.
21 | *
22 | * @return The sample
23 | */
24 | double sample();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/ExponentialDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.distributions;
10 |
11 | import java.util.Random;
12 |
13 | /**
14 | * An exponential number generator.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | */
19 | public class ExponentialDistr implements ContinuousDistribution {
20 |
21 | /** The num gen. */
22 | private final Random numGen;
23 |
24 | /** The mean. */
25 | private final double mean;
26 |
27 | /**
28 | * Creates a new exponential number generator.
29 | *
30 | * @param seed the seed to be used.
31 | * @param mean the mean for the distribution.
32 | */
33 | public ExponentialDistr(long seed, double mean) {
34 | if (mean <= 0.0) {
35 | throw new IllegalArgumentException("Mean must be greater than 0.0");
36 | }
37 | numGen = new Random(seed);
38 | this.mean = mean;
39 | }
40 |
41 | /**
42 | * Creates a new exponential number generator.
43 | *
44 | * @param mean the mean for the distribution.
45 | */
46 | public ExponentialDistr(double mean) {
47 | if (mean <= 0.0) {
48 | throw new IllegalArgumentException("Mean must be greated than 0.0");
49 | }
50 | numGen = new Random(System.currentTimeMillis());
51 | this.mean = mean;
52 | }
53 |
54 | /**
55 | * Generate a new random number.
56 | *
57 | * @return the next random number in the sequence
58 | */
59 | @Override
60 | public double sample() {
61 | return -mean * Math.log(numGen.nextDouble());
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/GammaDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Descripimport java.util.Random;
4 | mulation) Toolkit for Modeling and Simulation of Clouds
5 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
6 | *
7 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
8 | */
9 |
10 | package org.cloudbus.cloudsim.distributions;
11 |
12 | import java.util.Random;
13 |
14 | /**
15 | * The Class GammaDistr.
16 | *
17 | * @author Marcos Dias de Assuncao
18 | * @since CloudSim Toolkit 1.0
19 | */
20 | public class GammaDistr implements ContinuousDistribution {
21 |
22 | /** The num gen. */
23 | private final Random numGen;
24 |
25 | /** The alpha. */
26 | private final int alpha;
27 |
28 | /** The beta. */
29 | private final double beta;
30 |
31 | /**
32 | * Instantiates a new gamma distr.
33 | *
34 | * @param seed the seed
35 | * @param alpha the alpha
36 | * @param beta the beta
37 | */
38 | public GammaDistr(Random seed, int alpha, double beta) {
39 | if (alpha <= 0 || beta <= 0.0) {
40 | throw new IllegalArgumentException("Alpha and beta must be greater than 0.0");
41 | }
42 |
43 | numGen = seed;
44 | this.alpha = alpha;
45 | this.beta = beta;
46 | }
47 |
48 | /**
49 | * Instantiates a new gamma distr.
50 | *
51 | * @param alpha the alpha
52 | * @param beta the beta
53 | */
54 | public GammaDistr(int alpha, double beta) {
55 | if (alpha <= 0 || beta <= 0.0) {
56 | throw new IllegalArgumentException("Alpha and beta must be greater than 0.0");
57 | }
58 |
59 | numGen = new Random(System.currentTimeMillis());
60 | this.alpha = alpha;
61 | this.beta = beta;
62 | }
63 |
64 | /*
65 | * (non-Javadoc)
66 | * @see cloudsim.distributions.ContinuousDistribution#sample()
67 | */
68 | @Override
69 | public double sample() {
70 | double sum = 0.0;
71 | for (int i = 0; i < alpha; i++) {
72 | sum += Math.log(numGen.nextDouble());
73 | }
74 |
75 | return -beta * sum;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/LognormalDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.distributions;
10 |
11 | import java.util.Random;
12 |
13 | /**
14 | * The Class LognormalDistr.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | */
19 | public class LognormalDistr implements ContinuousDistribution {
20 |
21 | /** The num gen. */
22 | private final Random numGen;
23 |
24 | /** The mean. */
25 | private final double mean;
26 |
27 | /** The dev. */
28 | private final double dev;
29 |
30 | /**
31 | * Instantiates a new lognormal distr.
32 | *
33 | * @param seed the seed
34 | * @param mean the mean
35 | * @param dev the dev
36 | */
37 | public LognormalDistr(Random seed, double mean, double dev) {
38 | if (mean <= 0.0 || dev <= 0.0) {
39 | throw new IllegalArgumentException("Mean and deviation must be greater than 0.0");
40 | }
41 |
42 | numGen = seed;
43 | this.mean = mean;
44 | this.dev = dev;
45 | }
46 |
47 | /**
48 | * Instantiates a new lognormal distr.
49 | *
50 | * @param mean the mean
51 | * @param dev the dev
52 | */
53 | public LognormalDistr(double mean, double dev) {
54 | if (mean <= 0.0 || dev <= 0.0) {
55 | throw new IllegalArgumentException("Mean and deviation must be greater than 0.0");
56 | }
57 |
58 | numGen = new Random(System.currentTimeMillis());
59 | this.mean = mean;
60 | this.dev = dev;
61 | }
62 |
63 | /*
64 | * (non-Javadoc)
65 | * @see cloudsim.distributions.ContinuousDistribution#sample()
66 | */
67 | @Override
68 | public double sample() {
69 | // generate a normal variate from a uniform variate
70 | double n = Math.sqrt(-2 * Math.log(numGen.nextDouble()))
71 | * Math.sin(2 * Math.PI * numGen.nextDouble());
72 |
73 | // use it to generate the lognormal variate
74 | return Math.pow(Math.E, mean + dev * n);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/LomaxDistribution.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.distributions;
10 |
11 | import java.util.Random;
12 |
13 | /**
14 | * The Class LomaxDistribution.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | */
19 | public class LomaxDistribution extends ParetoDistr implements ContinuousDistribution {
20 |
21 | /** The shift. */
22 | private final double shift;
23 |
24 | /**
25 | * Instantiates a new lomax distribution.
26 | *
27 | * @param shape the shape
28 | * @param location the location
29 | * @param shift the shift
30 | */
31 | public LomaxDistribution(double shape, double location, double shift) {
32 | super(shape, location);
33 |
34 | if (shift > location) {
35 | throw new IllegalArgumentException("Shift must be smaller or equal than location");
36 | }
37 |
38 | this.shift = shift;
39 | }
40 |
41 | /**
42 | * Instantiates a new lomax distribution.
43 | *
44 | * @param seed the seed
45 | * @param shape the shape
46 | * @param location the location
47 | * @param shift the shift
48 | */
49 | public LomaxDistribution(Random seed, double shape, double location, double shift) {
50 | super(seed, shape, location);
51 |
52 | if (shift > location) {
53 | throw new IllegalArgumentException("Shift must be smaller or equal than location");
54 | }
55 |
56 | this.shift = shift;
57 | }
58 |
59 | /*
60 | * (non-Javadoc)
61 | * @see cloudsim.distributions.ParetoDistr#sample()
62 | */
63 | @Override
64 | public double sample() {
65 | return super.sample() - shift;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/ParetoDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Descripimport java.util.Random;
4 | mulation) Toolkit for Modeling and Simulation of Clouds
5 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
6 | *
7 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
8 | */
9 |
10 | package org.cloudbus.cloudsim.distributions;
11 |
12 | import java.util.Random;
13 |
14 | /**
15 | * The Class ParetoDistr.
16 | *
17 | * @author Marcos Dias de Assuncao
18 | * @since CloudSim Toolkit 1.0
19 | */
20 | public class ParetoDistr implements ContinuousDistribution {
21 |
22 | /** The num gen. */
23 | private final Random numGen;
24 |
25 | /** The shape. */
26 | private final double shape;
27 |
28 | /** The location. */
29 | private final double location;
30 |
31 | /**
32 | * Instantiates a new pareto distr.
33 | *
34 | * @param seed the seed
35 | * @param shape the shape
36 | * @param location the location
37 | */
38 | public ParetoDistr(Random seed, double shape, double location) {
39 | if (shape <= 0.0 || location <= 0.0) {
40 | throw new IllegalArgumentException("Mean and deviation must be greater than 0.0");
41 | }
42 |
43 | numGen = seed;
44 | this.shape = shape;
45 | this.location = location;
46 | }
47 |
48 | /**
49 | * Instantiates a new pareto distr.
50 | *
51 | * @param shape the shape
52 | * @param location the location
53 | */
54 | public ParetoDistr(double shape, double location) {
55 | if (shape <= 0.0 || location <= 0.0) {
56 | throw new IllegalArgumentException("Mean and deviation must be greater than 0.0");
57 | }
58 |
59 | numGen = new Random(System.currentTimeMillis());
60 | this.shape = shape;
61 | this.location = location;
62 | }
63 |
64 | /*
65 | * (non-Javadoc)
66 | * @see cloudsim.distributions.ContinuousDistribution#sample()
67 | */
68 | @Override
69 | public double sample() {
70 | return location / Math.pow(numGen.nextDouble(), 1 / shape);
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/UniformDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.distributions;
10 |
11 | import java.util.Random;
12 |
13 | /**
14 | * A random number generator based on the Uniform distribution.
15 | *
16 | * @author Marcos Dias de Assuncao
17 | * @since CloudSim Toolkit 1.0
18 | */
19 | public class UniformDistr implements ContinuousDistribution {
20 |
21 | /** The num gen. */
22 | private final Random numGen;
23 |
24 | /** The min. */
25 | private final double mag, min;
26 |
27 | /**
28 | * Creates new uniform distribution.
29 | *
30 | * @param min minimum value
31 | * @param max maximum value
32 | */
33 | public UniformDistr(double min, double max) {
34 | if (min >= max) {
35 | throw new IllegalArgumentException("Maximum must be greater than the minimum.");
36 | }
37 | numGen = new Random();
38 | mag = max - min;
39 | this.min = min;
40 | }
41 |
42 | /**
43 | * Creates new uniform distribution.
44 | *
45 | * @param min minimum value
46 | * @param max maximum value
47 | * @param seed simulation seed to be used
48 | */
49 | public UniformDistr(double min, double max, long seed) {
50 | if (min >= max) {
51 | throw new IllegalArgumentException("Maximum must be greater than the minimum.");
52 | }
53 |
54 | numGen = new Random(seed);
55 | mag = max - min;
56 | this.min = min;
57 | }
58 |
59 | /**
60 | * Generate a new random number.
61 | *
62 | * @return the next random number in the sequence
63 | */
64 | @Override
65 | public double sample() {
66 | return (numGen.nextDouble() * (mag)) + min;
67 | }
68 |
69 | /**
70 | * Generates a new random number based on the number generator and values provided as
71 | * parameters.
72 | *
73 | * @param rd the random number generator
74 | * @param min the minimum value
75 | * @param max the maximum value
76 | * @return the next random number in the sequence
77 | */
78 | public static double sample(Random rd, double min, double max) {
79 | if (min >= max) {
80 | throw new IllegalArgumentException("Maximum must be greater than the minimum.");
81 | }
82 |
83 | return (rd.nextDouble() * (max - min)) + min;
84 | }
85 |
86 | /**
87 | * Set the random number generator's seed.
88 | *
89 | * @param seed the new seed for the generator
90 | */
91 | public void setSeed(long seed) {
92 | numGen.setSeed(seed);
93 | }
94 |
95 | }
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/WeibullDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Descripimport java.util.Random;
4 | mulation) Toolkit for Modeling and Simulation of Clouds
5 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
6 | *
7 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
8 | */
9 |
10 | package org.cloudbus.cloudsim.distributions;
11 |
12 | import java.util.Random;
13 |
14 | /**
15 | * The Class WeibullDistr.
16 | *
17 | * @author Marcos Dias de Assuncao
18 | * @since CloudSim Toolkit 1.0
19 | */
20 | public class WeibullDistr implements ContinuousDistribution {
21 |
22 | /** The num gen. */
23 | private final Random numGen;
24 |
25 | /** The alpha. */
26 | private final double alpha;
27 |
28 | /** The beta. */
29 | private final double beta;
30 |
31 | /**
32 | * Instantiates a new weibull distr.
33 | *
34 | * @param seed the seed
35 | * @param alpha the alpha
36 | * @param beta the beta
37 | */
38 | public WeibullDistr(Random seed, double alpha, double beta) {
39 | if (alpha <= 0.0 || beta <= 0.0) {
40 | throw new IllegalArgumentException("Alpha and beta must be greater than 0.0");
41 | }
42 |
43 | numGen = seed;
44 | this.alpha = alpha;
45 | this.beta = beta;
46 | }
47 |
48 | /**
49 | * Instantiates a new weibull distr.
50 | *
51 | * @param alpha the alpha
52 | * @param beta the beta
53 | */
54 | public WeibullDistr(double alpha, double beta) {
55 | if (alpha <= 0.0 || beta <= 0.0) {
56 | throw new IllegalArgumentException("Alpha and beta must be greater than 0.0");
57 | }
58 |
59 | numGen = new Random(System.currentTimeMillis());
60 | this.alpha = alpha;
61 | this.beta = beta;
62 | }
63 |
64 | /*
65 | * (non-Javadoc)
66 | * @see cloudsim.distributions.ContinuousDistribution#sample()
67 | */
68 | @Override
69 | public double sample() {
70 | return beta * Math.pow(-Math.log(numGen.nextDouble()), 1 / alpha);
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/distributions/ZipfDistr.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Descripimport java.util.Random;
4 | mulation) Toolkit for Modeling and Simulation of Clouds
5 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
6 | *
7 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
8 | */
9 |
10 | package org.cloudbus.cloudsim.distributions;
11 |
12 | import java.util.Random;
13 |
14 | /**
15 | * The Class ZipfDistr.
16 | *
17 | * @author Marcos Dias de Assuncao
18 | * @since CloudSim Toolkit 1.0
19 | */
20 | public class ZipfDistr implements ContinuousDistribution {
21 |
22 | /** The num gen. */
23 | private final Random numGen;
24 |
25 | /** The shape. */
26 | private final double shape;
27 |
28 | /** The den. */
29 | private double den;
30 |
31 | /**
32 | * Instantiates a new zipf distr.
33 | *
34 | * @param seed the seed
35 | * @param shape the shape
36 | * @param population the population
37 | */
38 | public ZipfDistr(long seed, double shape, int population) {
39 | if (shape <= 0.0 || population < 1) {
40 | throw new IllegalArgumentException("Mean must be greater than 0.0 and population greater than 0");
41 | }
42 | numGen = new Random(seed);
43 | this.shape = shape;
44 |
45 | computeDen(shape, population);
46 | }
47 |
48 | /**
49 | * Instantiates a new zipf distr.
50 | *
51 | * @param shape the shape
52 | * @param population the population
53 | */
54 | public ZipfDistr(double shape, int population) {
55 | if (shape <= 0.0) {
56 | throw new IllegalArgumentException("Mean must be greated than 0.0 and population greater than 0");
57 | }
58 | numGen = new Random(System.currentTimeMillis());
59 | this.shape = shape;
60 | computeDen(shape, population);
61 | }
62 |
63 | /**
64 | * Generate a new random number.
65 | *
66 | * @return the next random number in the sequence
67 | */
68 | @Override
69 | public double sample() {
70 | double variate = numGen.nextDouble();
71 | double num = 1;
72 | double nextNum = 1 + 1 / Math.pow(2, shape);
73 | double j = 3;
74 |
75 | while (variate > nextNum / den) {
76 | num = nextNum;
77 | nextNum += 1 / Math.pow(j, shape);
78 | j++;
79 | }
80 |
81 | return num / den;
82 | }
83 |
84 | /**
85 | * Compute den.
86 | *
87 | * @param shape the shape
88 | * @param population the population
89 | */
90 | private void computeDen(double shape, int population) {
91 | den = 0.0;
92 | for (int j = 1; j <= population; j++) {
93 | den += 1 / Math.pow(j, shape);
94 | }
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/lists/VmList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.lists;
10 |
11 | import java.util.List;
12 |
13 | import org.cloudbus.cloudsim.Vm;
14 |
15 | /**
16 | * VmList is a collection of operations on lists of VMs.
17 | *
18 | * @author Anton Beloglazov
19 | * @since CloudSim Toolkit 2.0
20 | */
21 | public class VmList {
22 |
23 | /**
24 | * Return a reference to a Vm object from its ID.
25 | *
26 | * @param id ID of required VM
27 | * @param vmList the vm list
28 | * @return Vm with the given ID, $null if not found
29 | * @pre $none
30 | * @post $none
31 | */
32 | public static T getById(List vmList, int id) {
33 | for (T vm : vmList) {
34 | if (vm.getId() == id) {
35 | return vm;
36 | }
37 | }
38 | return null;
39 | }
40 |
41 | /**
42 | * Return a reference to a Vm object from its ID and user ID.
43 | *
44 | * @param id ID of required VM
45 | * @param userId the user ID
46 | * @param vmList the vm list
47 | * @return Vm with the given ID, $null if not found
48 | * @pre $none
49 | * @post $none
50 | */
51 | public static T getByIdAndUserId(List vmList, int id, int userId) {
52 | for (T vm : vmList) {
53 | if (vm.getId() == id && vm.getUserId() == userId) {
54 | return vm;
55 | }
56 | }
57 | return null;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/GraphReaderIF.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network;
10 |
11 | import java.io.IOException;
12 |
13 | /**
14 | * This interface abstracts an reader for different graph-file-formats
15 | *
16 | * @author Thomas Hohnstein
17 | * @since CloudSim Toolkit 1.0
18 | */
19 | public interface GraphReaderIF {
20 |
21 | /**
22 | * this method just reads the file and creates an TopologicalGraph object
23 | *
24 | * @param filename name of the file to read
25 | * @return created TopologicalGraph
26 | * @throws IOException
27 | */
28 | TopologicalGraph readGraphFile(String filename) throws IOException;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/TopologicalLink.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network;
10 |
11 | /**
12 | * This class represents an link (edge) from an graph
13 | *
14 | * @author Thomas Hohnstein
15 | * @since CloudSim Toolkit 1.0
16 | */
17 | public class TopologicalLink {
18 |
19 | /**
20 | * id of the link src node-id
21 | */
22 | private int srcNodeID = 0;
23 |
24 | /**
25 | * id of the link dest node-id
26 | */
27 | private int destNodeID = 0;
28 |
29 | /**
30 | * representing the link-delay of the connection
31 | */
32 | private float linkDelay = 0;
33 |
34 | private float linkBw = 0;
35 |
36 | /**
37 | * creates an new link-object
38 | */
39 | public TopologicalLink(int srcNode, int destNode, float delay, float bw) {
40 | // lets initialize all internal attributes
41 | linkDelay = delay;
42 | srcNodeID = srcNode;
43 | destNodeID = destNode;
44 | linkBw = bw;
45 | }
46 |
47 | /**
48 | * returns the node-ID from the SrcNode
49 | *
50 | * @return nodeID
51 | */
52 | public int getSrcNodeID() {
53 | return srcNodeID;
54 | }
55 |
56 | /**
57 | * return the node-ID from the DestNode
58 | *
59 | * @return nodeID
60 | */
61 | public int getDestNodeID() {
62 | return destNodeID;
63 | }
64 |
65 | /**
66 | * return the link-delay of the defined linke
67 | *
68 | * @return the delay-amount
69 | */
70 | public float getLinkDelay() {
71 | return linkDelay;
72 | }
73 |
74 | /**
75 | * return the link-bw of the defined linke
76 | *
77 | * @return the bw
78 | */
79 | public float getLinkBw() {
80 | return linkBw;
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/TopologicalNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network;
10 |
11 | /**
12 | * Just represents an topological network node retrieves its information from an
13 | * topological-generated file (eg. topology-generator)
14 | *
15 | * @author Thomas Hohnstein
16 | * @since CloudSim Toolkit 1.0
17 | */
18 | public class TopologicalNode {
19 |
20 | /**
21 | * its the nodes-ID inside this network
22 | */
23 | private int nodeID = 0;
24 |
25 | /**
26 | * describes the nodes-name inside the network
27 | */
28 | private String nodeName = null;
29 |
30 | /**
31 | * representing the x an y world-coordinates
32 | */
33 | private int worldX = 0;
34 |
35 | private int worldY = 0;
36 |
37 | /**
38 | * constructs an new node
39 | */
40 | public TopologicalNode(int nodeID) {
41 | // lets initialize all private class attributes
42 | this.nodeID = nodeID;
43 | nodeName = String.valueOf(nodeID);
44 | }
45 |
46 | /**
47 | * constructs an new node including world-coordinates
48 | */
49 | public TopologicalNode(int nodeID, int x, int y) {
50 | // lets initialize all private class attributes
51 | this.nodeID = nodeID;
52 | nodeName = String.valueOf(nodeID);
53 | worldX = x;
54 | worldY = y;
55 | }
56 |
57 | /**
58 | * constructs an new node including world-coordinates and the nodeName
59 | */
60 | public TopologicalNode(int nodeID, String nodeName, int x, int y) {
61 | // lets initialize all private class attributes
62 | this.nodeID = nodeID;
63 | this.nodeName = nodeName;
64 | worldX = x;
65 | worldY = y;
66 | }
67 |
68 | /**
69 | * delivers the nodes id
70 | *
71 | * @return just the nodeID
72 | */
73 | public int getNodeID() {
74 | return nodeID;
75 | }
76 |
77 | /**
78 | * delivers the name of the node
79 | *
80 | * @return name of the node
81 | */
82 | public String getNodeLabel() {
83 | return nodeName;
84 | }
85 |
86 | /**
87 | * returns the x coordinate of this network-node
88 | *
89 | * @return the x coordinate
90 | */
91 | public int getCoordinateX() {
92 | return worldX;
93 | }
94 |
95 | /**
96 | * returns the y coordinate of this network-node
97 | *
98 | * @return the y coordinate
99 | */
100 | public int getCoordinateY() {
101 | return worldY;
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/datacenter/HostPacket.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network.datacenter;
10 |
11 | /**
12 | * HostPacket represents the packet that travels through the virtual network with a Host. It
13 | * contains information about cloudlets which are communicating
14 | *
15 | * Please refer to following publication for more details:
16 | *
17 | * Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
18 | * Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
19 | * Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
20 | *
21 | * @author Saurabh Kumar Garg
22 | * @since CloudSim Toolkit 1.0
23 | */
24 | public class HostPacket {
25 |
26 | public HostPacket(
27 | int sender,
28 | int reciever,
29 | double data,
30 | double sendtime,
31 | double recievetime,
32 | int vsnd,
33 | int vrvd) {
34 | super();
35 | this.sender = sender;
36 | this.reciever = reciever;
37 | this.data = data;
38 | this.sendtime = sendtime;
39 | this.recievetime = recievetime;
40 | virtualrecvid = vrvd;
41 | virtualsendid = vsnd;
42 | }
43 |
44 | int sender;
45 |
46 | int virtualrecvid;
47 |
48 | int virtualsendid;
49 |
50 | int reciever;
51 |
52 | double data;
53 |
54 | double sendtime;
55 |
56 | double recievetime;
57 | }
58 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/datacenter/NetworkConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network.datacenter;
10 |
11 | public class NetworkConstants {
12 |
13 | public static int maxhostVM = 2;
14 | public static int HOST_PEs = 8;
15 |
16 | public static double maxMemperVM = 1024 * 1024;// kb
17 |
18 | public static int currentCloudletId = 0;
19 | public static int currentAppId = 0;
20 |
21 | // stage type
22 | public static final int EXECUTION = 0;
23 | public static final int WAIT_SEND = 1;
24 | public static final int WAIT_RECV = 2;
25 | public static final int FINISH = -2;
26 |
27 | // number of switches at each level
28 | public static final int ROOT_LEVEL = 0;
29 | public static final int Agg_LEVEL = 1;
30 | public static final int EDGE_LEVEL = 2;
31 |
32 | public static final int PES_NUMBER = 4;
33 | public static final int FILE_SIZE = 300;
34 | public static final int OUTPUT_SIZE = 300;
35 |
36 | public static final int COMMUNICATION_LENGTH = 1;
37 |
38 | public static boolean BASE = true;
39 |
40 | public static long BandWidthEdgeAgg = 100 * 1024 * 1024;// 100 Megabits
41 | public static long BandWidthEdgeHost = 100 * 1024 * 1024;//
42 | public static long BandWidthAggRoot = 20 * 1024 * 1024 * 2;// 40gb
43 |
44 | public static double SwitchingDelayRoot = .00285;
45 | public static double SwitchingDelayAgg = .00245;// .00245
46 | public static double SwitchingDelayEdge = .00157;// ms
47 |
48 | public static double EdgeSwitchPort = 4;// number of host
49 |
50 | public static double AggSwitchPort = 1;// number of Edge
51 |
52 | public static double RootSwitchPort = 1;// number of Agg
53 |
54 | public static double seed = 199;
55 |
56 | public static boolean logflag = false;
57 |
58 | public static int iteration = 10;
59 | public static int nexttime = 1000;
60 |
61 | public static int totaldatatransfer = 0;
62 | }
63 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/datacenter/NetworkPacket.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network.datacenter;
10 |
11 | /**
12 | * NewtorkPacket represents the packet which travel from one server to another. Each packet contains
13 | * ids of the sender VM and receiver VM, time at which it is send and received, type and virtual ids
14 | * of tasks, which are communicating.
15 | *
16 | * Please refer to following publication for more details:
17 | *
18 | * Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
19 | * Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
20 | * Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
21 | *
22 | * @author Saurabh Kumar Garg
23 | * @since CloudSim Toolkit 1.0
24 | */
25 | public class NetworkPacket {
26 |
27 | public NetworkPacket(int id, HostPacket pkt2, int vmid, int cloudletid) {
28 | pkt = pkt2;
29 | sendervmid = vmid;
30 | this.cloudletid = cloudletid;
31 | senderhostid = id;
32 | stime = pkt.sendtime;
33 | recievervmid = pkt2.reciever;
34 |
35 | }
36 |
37 | HostPacket pkt;
38 |
39 | int senderhostid;
40 |
41 | int recieverhostid;
42 |
43 | int sendervmid;
44 |
45 | int recievervmid;
46 |
47 | int cloudletid;
48 |
49 | double stime;// time when sent
50 |
51 | double rtime;// time when received
52 | }
53 |
--------------------------------------------------------------------------------
/src/org/cloudbus/cloudsim/network/datacenter/NetworkVm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: CloudSim Toolkit
3 | * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
4 | * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
5 | *
6 | * Copyright (c) 2009-2012, The University of Melbourne, Australia
7 | */
8 |
9 | package org.cloudbus.cloudsim.network.datacenter;
10 |
11 | import java.util.ArrayList;
12 |
13 | import org.cloudbus.cloudsim.CloudletScheduler;
14 | import org.cloudbus.cloudsim.Vm;
15 |
16 | /**
17 | * NetworkVm class extends Vm to support simulation of networked datacenters. It executes actions
18 | * related to management of packets (send and receive).
19 | *
20 | * Please refer to following publication for more details:
21 | *
22 | * Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
23 | * Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
24 | * Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
25 | *
26 | * @author Saurabh Kumar Garg
27 | * @since CloudSim Toolkit 3.0
28 | */
29 | public class NetworkVm extends Vm implements Comparable