Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / examples / java / energy / consumption / Main.java
1 /* Copyright (c) 2012-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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
7 package energy.consumption;
8
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.Host;
11 import org.simgrid.msg.MsgException;
12
13 public class Main {
14   public static final double task_comp_size = 10;
15   public static final double task_comm_size = 10;
16   public static final int hostNB = 2 ; 
17   private Main() {
18     throw new IllegalAccessError("Utility class");
19   }
20
21   public static void main(String[] args) throws MsgException {  
22     Msg.energyInit(); 
23     Msg.init(args); 
24
25     if (args.length < 1) {
26       Msg.info("Usage   : Energy platform_file");
27       Msg.info("Usage  : Energy ../platforms/energy_platform.xml");
28       System.exit(1);
29     }
30     /* Construct the platform */
31     Msg.createEnvironment(args[0]);
32     /* Instanciate a process */
33     new EnergyConsumer("MyHost1","energyConsumer").start();
34     /* Execute the simulation */
35     Msg.run();
36     Msg.info("Total simulation time: "+  Msg.getClock());
37   }
38 }