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. */
7 //package cloud.energy;
9 import org.simgrid.msg.*;
10 import org.simgrid.msg.Process;
12 public class Test extends Process{
15 public class DummyProcess extends Process {
16 public DummyProcess (Host host, String name) {
20 public void main(String[] args) {
21 Task task = new Task(this.getHost().getName()+"-task", 30E6 , 0);
24 } catch (Exception e) {
28 Msg.info("This worker is done.");
32 Test(Host host, String name, String[] args) throws HostNotFoundException, NativeException {
33 super(host, name, args);
36 public void main(String[] strings) throws MsgException {
47 host1 = Host.getByName("MyHost1");
48 host2 = Host.getByName("MyHost2");
49 host3 = Host.getByName("MyHost3");
50 } catch (HostNotFoundException e) {
51 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
56 Msg.info("Creating and starting two VMs");
65 1024 * 20, //size of disk image,
67 50 // Memory intensity
79 1024 * 20, //size of disk image,
81 50 // Memory intensity
85 Msg.info("Create two tasks on Host1: one inside a VM, the other directly on the host");
86 DummyProcess p11 = new DummyProcess (vmHost1, "p11");
88 DummyProcess p12 = new DummyProcess (host1, "p12");
91 Msg.info("Create two tasks on Host2: both directly on the host");
92 DummyProcess p21 = new DummyProcess (host2, "p21");
94 DummyProcess p22 = new DummyProcess (host2, "p22");
97 Msg.info("Create two tasks on Host3: both inside a VM");
98 DummyProcess p31 = new DummyProcess (vmHost3, "p31");
100 DummyProcess p32 = new DummyProcess (vmHost3, "p312");
103 Msg.info("Wait 5 seconde. The tasks are still runing (they run for 3 secondes, but 2 tasks are co-located, so they run for 6 seconds)");
105 Msg.info("Wait another 5 seconds. The tasks stop at some point in between");