1 /* Copyright (c) 2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
6 package cloud.migration;
8 import org.simgrid.msg.*;
9 import org.simgrid.msg.Process;
11 public class Test extends Process{
13 Test(Host host, String name, String[] args) throws HostNotFoundException, NativeException {
14 super(host, name, args);
17 public void main(String[] strings) throws MsgException {
22 /* get hosts 1 and 2*/
27 host0 = Host.getByName("host0");
28 host1 = Host.getByName("host1");
29 }catch (HostNotFoundException e) {
30 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
46 -1, //size of disk image,
47 125, // Net bandwidth,
48 dpRate // Memory intensity
55 int collocatedSrc = 6;
66 for (int i=1 ; i<= collocatedSrc ; i++){
74 -1, //size of disk image,
75 125, // Net bandwidth,
76 dpRate // Memory intensity
79 tmp.setLoad(vmSrcLoad[i-1]);
82 int collocatedDst = 6;
92 for (int i=1 ; i <= collocatedDst ; i++){
100 -1, //size of disk image,
101 125, // Net bandwidth,
102 dpRate // Memory intensity
105 tmp.setLoad(vmDstLoad[i-1]);
112 Msg.info("Round trip of VM1 (load "+load1+"%)");
114 Msg.info(" - Launch migration from host 0 to host 1");
115 startTime = Msg.getClock();
117 endTime = Msg.getClock();
118 Msg.info(" - End of Migration from host 0 to host 1 (duration:"+(endTime-startTime)+")");
119 Msg.info(" - Launch migration from host 1 to host 0");
120 startTime = Msg.getClock();
122 endTime = Msg.getClock();
123 Msg.info(" - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");
125 Msg.info("\n \n \nRound trip of VM1 (load "+load2+"%)");
127 Msg.info(" - Launch migration from host 0 to host 1");
128 startTime = Msg.getClock();
130 endTime = Msg.getClock();
131 Msg.info(" - End of Migration from host 0 to host 1 (duration:"+(endTime-startTime)+")");
132 Msg.info(" - Launch migration from host 1 to host 0");
133 startTime = Msg.getClock();
135 endTime = Msg.getClock();
136 Msg.info(" - End of Migration from host 1 to host 0 (duration:"+(endTime-startTime)+")");