Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
6205296250dafdc55b483a61c70bae7cbb8465c3
[simgrid.git] / examples / java / tracing / TracingTest.java
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier         
5  * Copyright (c) 2012-2013. The SimGrid Team.
6  * All rights reserved.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the license (GNU LGPL) which comes with this package. 
10  */
11 package tracing;
12 import org.simgrid.msg.Msg;
13 import org.simgrid.trace.Trace;
14 import org.simgrid.msg.NativeException;
15  
16 public class TracingTest  {
17
18    /* This only contains the launcher. If you do nothing more than than you can run 
19     *   java simgrid.msg.Msg
20     * which also contains such a launcher
21     */
22     
23     public static void main(String[] args) throws NativeException {     
24                 /* initialize the MSG simulation. Must be done before anything else (even logging). */
25                 Msg.init(args);
26                 if(args.length < 2) {
27                         Msg.info("Usage   : PingPong platform_file deployment_file");
28                 Msg.info("example : PingPong ping_pong_platform.xml ping_pong_deployment.xml");
29                 System.exit(1);
30                 }
31         
32                 /* construct the platform and deploy the application */
33                 Msg.createEnvironment(args[0]);
34                 Msg.deployApplication(args[1]);
35
36                 /* Initialize some state for the hosts */
37                 Trace.hostStateDeclare ("PM_STATE"); 
38                 Trace.hostStateDeclareValue ("PM_STATE", "waitingPing", "0 0 1");
39                 Trace.hostStateDeclareValue ("PM_STATE", "sendingPong", "0 1 0");
40                 Trace.hostStateDeclareValue ("PM_STATE", "sendingPing", "0 1 1");
41                 Trace.hostStateDeclareValue ("PM_STATE", "waitingPong", "1 0 0");
42
43                 /*  execute the simulation. */
44             Msg.run();
45     }
46 }