You can specify a start time and a kill time in the deployment
file. See all *_d.xml files in this directory.
+ - <b>Using Pstates on a host</b>
+ @ref examples/msg/energy-pstate/energy-pstate.c\n
+ Show how define a set of pstates for a host and how the current
+ pstate can be accessed/changed with @ref MSG_get_host_current_power_peak and @ref MSG_set_host_pstate.
+ See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
+
@section msg_ex_tracing Tracing and visualization features
Tracing can be activated by various configuration options which
displayed as arrows in a Gantt-chart visualization. Recommanded
options to that extend:
@verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
- @endverbatim
-
+ @endverbatim
+
TODO: These tracing examples should be integrated in the examples to
not duplicate the C files. A full command line to see the result in
the right tool (vite/FrameSoc) should be given along with some
foreach (example actions-comm actions-storage
actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
- app-masterworker app-pingpong app-token-ring
+ app-masterworker app-pingpong app-token-ring energy-pstate
async-wait async-waitany async-waitall
energy-link
plugin-hostload io mutex)
set(examples_src ${examples_src} PARENT_SCOPE)
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent.tesh
${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/energy-pstate/s4u-energy-pstate.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield.tesh
foreach(example actions-comm actions-storage
actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
- app-bittorrent app-masterworker app-pingpong app-token-ring
+ app-bittorrent app-masterworker app-pingpong app-token-ring energy-pstate
async-wait async-waitall async-waitany
dht-chord
energy-link
@ref examples/s4u/actor-migration/s4u-actor-migration.cpp \n
Actors can move or be moved from a host to another with the @ref migrate method.
+ - <b>Using Pstates on a host</b>
+ @ref examples/s4u/energy-pstate/s4u-energy-pstate.c\n
+ Show how define a set of pstates for a host and how the current
+ pstate can be accessed/changed with @ref getPstateSpeed and @ref sg_host_set_pstate.
+ See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
+
- <b>Yielding to other actor</b>.
@ref examples/s4u/actor-yield/s4u-actor-yield.c\n
The simgrid::s4u::this_actor::yield() function interrupts the
--- /dev/null
+/* Copyright (c) 2007-2010, 2013-2015. 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. */
+
+ #include "simgrid/s4u.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Pstate properties test");
+
+static int dvfs(std::vector<std::string> args)
+{
+ double workload = 100E6;
+ sg_host_t host = simgrid::s4u::this_actor::getHost();
+
+ int nb = sg_host_get_nb_pstates(host);
+ XBT_INFO("Count of Processor states=%d", nb);
+
+ XBT_INFO("Current power peak=%f", host->getSpeed());
+
+ // Run a task
+ simgrid::s4u::this_actor::execute(workload);
+
+ double task_time = simgrid::s4u::Engine::getClock();
+ XBT_INFO("Task1 simulation time: %e", task_time);
+
+ // Change power peak
+ int new_pstate = 2;
+
+ XBT_INFO("Changing power peak value to %f (at index %d)", host->getPstateSpeed(new_pstate), new_pstate);
+
+ sg_host_set_pstate(host, new_pstate);
+
+ XBT_INFO("Current power peak=%f", host->getSpeed());
+
+ // Run a second task
+ simgrid::s4u::this_actor::execute(workload);
+
+ task_time = simgrid::s4u::Engine::getClock() - task_time;
+ XBT_INFO("Task2 simulation time: %e", task_time);
+
+ // Verify the default pstate is set to 0
+ host = simgrid::s4u::Host::by_name_or_null("MyHost2");
+ XBT_INFO("Count of Processor states=%d", sg_host_get_nb_pstates(host));
+
+ XBT_INFO("Current power peak=%f", host->getSpeed());
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ std::vector<std::string> args;
+
+ xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+ e.loadPlatform(argv[1]); /* - Load the platform description */
+
+ simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs, args);
+ simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost2"), dvfs, args);
+
+ e.run();
+
+ XBT_INFO("Total simulation time: %e", e.getClock());
+
+ return 0;
+}
--- /dev/null
+#! ./tesh
+
+p Testing the DVFS-related functions
+
+$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+> [ 0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [ 0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
+> [ 1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
+> [ 1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
+> [ 1.000000] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
+> [ 1.000000] (2:dvfs_test@MyHost2) Changing power peak value to 20000000.000000 (at index 2)
+> [ 1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [ 1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [ 6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
+> [ 6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [ 6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [ 6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
+> [ 6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [ 6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [ 6.000000] (0:maestro@) Total simulation time: 6.000000e+00
+
+$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${srcdir:=.}/../platforms/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+> [ 0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [ 0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
+> [ 1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
+> [ 1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
+> [ 1.000000] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
+> [ 1.000000] (2:dvfs_test@MyHost2) Changing power peak value to 20000000.000000 (at index 2)
+> [ 1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [ 1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [ 6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
+> [ 6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [ 6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [ 6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
+> [ 6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [ 6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [ 6.000000] (0:maestro@) Total simulation time: 6.000000e+00