1 /* Copyright (c) 2014-2018. 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.migration;
9 import org.simgrid.msg.*;
10 import org.simgrid.msg.Process;
12 public class Daemon extends Process {
13 private Task currentTask;
14 public Daemon(VM vm) {
15 super((Host)vm,"Daemon");
16 currentTask = new Task(this.getHost().getName()+"-daemon-0", this.getHost().getSpeed()*100, 0);
18 public void main(String[] args) throws MsgException {
20 while(!Main.isEndOfTest()) {
21 // TODO the binding is not yet available
23 currentTask.execute();
24 } catch (HostFailureException e) {
26 } catch (TaskCancelledException e) {
27 Msg.info("task cancelled");
28 suspend(); // Suspend the process
30 currentTask = new Task(this.getHost().getName()+"-daemon-"+(i++), this.getHost().getSpeed()*100, 0);
34 public double getRemaining(){
35 return this.currentTask.getFlopsAmount();