Skip to content

Commit

Permalink
Sets the name of the broker as the app number for NetworkVmExamples.
Browse files Browse the repository at this point in the history
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
  • Loading branch information
manoelcampos committed Oct 24, 2023
1 parent bd46d98 commit fe54eec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,12 @@ private void showSimulationResults() {
for(int i = 0; i < APPS_NUMBER; i++){
final DatacenterBroker broker = brokerList.get(i);
final var newCloudletList = broker.getCloudletFinishedList();
String caption = broker.getName() + " - Application " + broker.getId();
new CloudletsTableBuilder(newCloudletList)
.setTitle(caption)
.setTitle(broker.getName())
.build();
System.out.printf(
"Number of NetworkCloudlets for Application %s: %d%n",
broker.getId(), newCloudletList.size());
"Number of NetworkCloudlets for %s (broker %d): %d%n",
broker.getName(), broker.getId(), newCloudletList.size());
}

for(NetworkHost host: datacenter.getHostList()){
Expand All @@ -153,8 +152,8 @@ private void showSimulationResults() {
*/
private List<DatacenterBroker> createBrokerForEachApp() {
final var brokerList = new ArrayList<DatacenterBroker>();
for(int i = 0; i < APPS_NUMBER; i++){
brokerList.add(new DatacenterBrokerSimple(simulation));
for(int i = 1; i <= APPS_NUMBER; i++){
brokerList.add(new DatacenterBrokerSimple(simulation, "App "+i));
}

return brokerList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public List<NetworkCloudlet> createNetworkCloudlets(DatacenterBroker broker) {
final List<NetworkVm> selectedVms = randomlySelectVmsForApp(networkCloudlets.length);

for(int i = 0; i < networkCloudlets.length; i++){
networkCloudlets[i] = createNetworkCloudlet(selectedVms.get(i), broker);
networkCloudlets[i] = createNetworkCloudlet(i, selectedVms.get(i), broker);
System.out.printf(
"Created NetworkCloudlet %d for Application %d%n",
networkCloudlets[i].getId(), broker.getId());
"Created NetworkCloudlet %d for %s (broker %d)%n",
networkCloudlets[i].getId(), broker.getName(), broker.getId());
}

//NetworkCloudlet 0 Tasks
Expand All @@ -61,13 +61,14 @@ public List<NetworkCloudlet> createNetworkCloudlets(DatacenterBroker broker) {
/**
* Creates a {@link NetworkCloudlet}.
*
* @param vm the VM that will run the created {@link NetworkCloudlet)
* @param id
* @param vm the VM that will run the created {@link NetworkCloudlet)
* @param broker the broker that will own the create NetworkCloudlet
* @return
*/
private NetworkCloudlet createNetworkCloudlet(NetworkVm vm, DatacenterBroker broker) {
private NetworkCloudlet createNetworkCloudlet(final int id, NetworkVm vm, DatacenterBroker broker) {
final var utilizationModel = new UtilizationModelFull();
final var cloudlet = new NetworkCloudlet(CLOUDLET_PES);
final var cloudlet = new NetworkCloudlet(id, CLOUDLET_PES);
cloudlet
.setFileSize(CLOUDLET_FILE_SIZE)
.setOutputSize(CLOUDLET_OUTPUT_SIZE)
Expand Down

0 comments on commit fe54eec

Please sign in to comment.