A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to fix a failure about mutex freed too early in RMA
[simgrid.git]
/
examples
/
cpp
/
energy-vm
/
s4u-energy-vm.cpp
diff --git
a/examples/cpp/energy-vm/s4u-energy-vm.cpp
b/examples/cpp/energy-vm/s4u-energy-vm.cpp
index 361566407979ce36a472e67327c9cd4fb4923fda..fedc42918416d50572b7a1264de4b86d02dd086d 100644
(file)
--- a/
examples/cpp/energy-vm/s4u-energy-vm.cpp
+++ b/
examples/cpp/energy-vm/s4u-energy-vm.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2007-202
2
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-202
3
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-8,18
+8,19
@@
#include "simgrid/s4u/VirtualMachine.hpp"
XBT_LOG_NEW_DEFAULT_CATEGORY(energy_vm, "Messages of this example");
#include "simgrid/s4u/VirtualMachine.hpp"
XBT_LOG_NEW_DEFAULT_CATEGORY(energy_vm, "Messages of this example");
+namespace sg4 = simgrid::s4u;
static void executor()
{
static void executor()
{
- s
imgrid::s4u
::this_actor::execute(300E6);
+ s
g4
::this_actor::execute(300E6);
XBT_INFO("This worker is done.");
}
static void dvfs()
{
XBT_INFO("This worker is done.");
}
static void dvfs()
{
- s
imgrid::s4u::Host* host1 = simgrid::s4u
::Host::by_name("MyHost1");
- s
imgrid::s4u::Host* host2 = simgrid::s4u
::Host::by_name("MyHost2");
- s
imgrid::s4u::Host* host3 = simgrid::s4u
::Host::by_name("MyHost3");
+ s
g4::Host* host1 = sg4
::Host::by_name("MyHost1");
+ s
g4::Host* host2 = sg4
::Host::by_name("MyHost2");
+ s
g4::Host* host3 = sg4
::Host::by_name("MyHost3");
/* Host 1 */
XBT_INFO("Creating and starting two VMs");
/* Host 1 */
XBT_INFO("Creating and starting two VMs");
@@
-29,22
+30,22
@@
static void dvfs()
vm_host2->start();
XBT_INFO("Create two activities on Host1: both inside a VM");
vm_host2->start();
XBT_INFO("Create two activities on Host1: both inside a VM");
- s
imgrid::s4u
::Actor::create("p11", vm_host1, executor);
- s
imgrid::s4u
::Actor::create("p12", vm_host1, executor);
+ s
g4
::Actor::create("p11", vm_host1, executor);
+ s
g4
::Actor::create("p12", vm_host1, executor);
XBT_INFO("Create two activities on Host2: one inside a VM, the other directly on the host");
XBT_INFO("Create two activities on Host2: one inside a VM, the other directly on the host");
- s
imgrid::s4u
::Actor::create("p21", vm_host2, executor);
- s
imgrid::s4u
::Actor::create("p22", host2, executor);
+ s
g4
::Actor::create("p21", vm_host2, executor);
+ s
g4
::Actor::create("p22", host2, executor);
XBT_INFO("Create two activities on Host3: both directly on the host");
XBT_INFO("Create two activities on Host3: both directly on the host");
- s
imgrid::s4u
::Actor::create("p31", host3, executor);
- s
imgrid::s4u
::Actor::create("p32", host3, executor);
+ s
g4
::Actor::create("p31", host3, executor);
+ s
g4
::Actor::create("p32", host3, executor);
XBT_INFO("Wait 5 seconds. The activities are still running (they run for 3 seconds, but 2 activities are co-located, "
"so they run for 6 seconds)");
XBT_INFO("Wait 5 seconds. The activities are still running (they run for 3 seconds, but 2 activities are co-located, "
"so they run for 6 seconds)");
- s
imgrid::s4u
::this_actor::sleep_for(5);
+ s
g4
::this_actor::sleep_for(5);
XBT_INFO("Wait another 5 seconds. The activities stop at some point in between");
XBT_INFO("Wait another 5 seconds. The activities stop at some point in between");
- s
imgrid::s4u
::this_actor::sleep_for(5);
+ s
g4
::this_actor::sleep_for(5);
vm_host1->destroy();
vm_host2->destroy();
vm_host1->destroy();
vm_host2->destroy();
@@
-53,19
+54,19
@@
static void dvfs()
int main(int argc, char* argv[])
{
sg_host_energy_plugin_init();
int main(int argc, char* argv[])
{
sg_host_energy_plugin_init();
- s
imgrid::s4u
::Engine e(&argc, argv);
+ s
g4
::Engine e(&argc, argv);
xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s ../platforms/energy_platform.xml\n", argv[0], argv[0]);
e.load_platform(argv[1]);
xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s ../platforms/energy_platform.xml\n", argv[0], argv[0]);
e.load_platform(argv[1]);
- s
imgrid::s4u
::Actor::create("dvfs", e.host_by_name("MyHost1"), dvfs);
+ s
g4
::Actor::create("dvfs", e.host_by_name("MyHost1"), dvfs);
e.run();
XBT_INFO("Total simulation time: %.2f; Host2 and Host3 must have the exact same energy consumption; Host1 is "
"multi-core and will differ.",
e.run();
XBT_INFO("Total simulation time: %.2f; Host2 and Host3 must have the exact same energy consumption; Host1 is "
"multi-core and will differ.",
- s
imgrid::s4u
::Engine::get_clock());
+ s
g4
::Engine::get_clock());
return 0;
}
return 0;
}