4 * Copyright 2006,2007 Martin Quinson, Malek Cherier
\r
5 * All right reserved.
\r
7 * This program is free software; you can redistribute
\r
8 * it and/or modify it under the terms of the license
\r
9 *(GNU LGPL) which comes with this package.
\r
13 /* Simulation member functions implementation.
\r
16 #include <Simulation.hpp>
\r
18 #include <Application.hpp>
\r
19 #include <Environment.hpp>
\r
21 #include <MsgException.hpp>
\r
22 #include <FileNotFoundException.hpp>
\r
26 #include <msg/msg.h>
\r
32 int Simulation::execute(int argc, char** argv)
\r
36 info("Usage: Msg platform_file deployment_file");
\r
40 // initialize the MSG simulator. Must be done before anything else (even logging).
\r
43 // the environment to load
\r
46 // the application to deploy
\r
50 // try to load the environment described by the xml file (argv[1])
\r
55 catch(FileNotFoundException e)
\r
62 // try to deploy the application described by the xml file deployment (argv[2])
\r
65 app.deploy(argv[2]);
\r
67 catch(FileNotFoundException e)
\r
74 //try to run the simulation the given application on the given environment
\r
79 catch(MsgException e)
\r
86 // finalize the MSG simulator
\r
91 catch(MsgException e)
\r
100 void Simulation::run(void)
\r
101 throw (MsgException)
\r
103 if(MSG_OK != MSG_main())
\r
104 throw MsgException("MSG_main() failed");
\r
107 } // namespace SimGrid
\r