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
17 #include <Application.hpp>
\r
18 #include <Environment.hpp>
\r
22 #include <Simulation.hpp>
\r
25 #include <msg/msg.h>
\r
31 int Simulation::execute(int argc, char** argv)
\r
35 info("Usage: Msg platform_file deployment_file");
\r
39 // initialize the MSG simulator. Must be done before anything else (even logging).
\r
42 // the environment to load
\r
45 // the application to deploy
\r
49 // try to load the environment described by the xml file (argv[1])
\r
54 catch(FileNotFoundException e)
\r
61 // try to deploy the application described by the xml file deployment (argv[2])
\r
64 app.deploy(argv[2]);
\r
66 catch(FileNotFoundException e)
\r
73 //try to run the simulation the given application on the given environment
\r
78 catch(MsgException e)
\r
85 // finalize the MSG simulator
\r
90 catch(MsgException e)
\r
99 void Simulation::run(void)
\r
100 throw (MsgException)
\r
102 if(MSG_OK != MSG_main())
\r
103 throw MsgException("MSG_main() failed");
\r
106 } // namespace SimGrid
\r