Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
oops. Clang bit me
[simgrid.git] / examples / s4u / execute-priority / s4u-execute-priority.cpp
1 /* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "simgrid/s4u.hpp"
7 #include "simgrid/forward.h"
8 #include "simgrid/s4u/forward.hpp"
9
10 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
11
12 static int test(int argc, char** argv)
13 {
14   double computation_amount = std::stod(argv[1]);
15   double priority           = std::stod(argv[2]);
16
17   XBT_INFO("Hello! Execute %g flops with priority %g", computation_amount, priority);
18   simgrid::s4u::ExecPtr activity = simgrid::s4u::Actor::self()->exec_init(computation_amount);
19   activity->setPriority(priority);
20   activity->start();
21   activity->wait();
22
23   XBT_INFO("Goodbye now!");
24   return 0;
25 }
26
27 int main(int argc, char* argv[])
28 {
29   simgrid::s4u::Engine e(&argc, argv);
30   e.loadPlatform(argv[1]); /* - Load the platform description */
31   e.registerFunction("test", test);
32   e.loadDeployment(argv[2]);
33
34   e.run();
35
36   XBT_INFO("Simulation time %g", e.getClock());
37
38   return 0;
39 }