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
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
async-wait async-waitany async-waitall
- energy-link energy-ptask
+ energy-link energy-pstate energy-ptask
io io-file-remote io-storage-raw
platform-properties plugin-hostload mutex)
add_executable (s4u-${example} ${example}/s4u-${example}.cpp)
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
app-bittorrent app-masterworker app-pingpong app-token-ring
async-wait async-waitall async-waitany
dht-chord
- energy-link energy-ptask
+ energy-link energy-pstate energy-ptask
platform-properties plugin-hostload mutex
io io-file-remote io-storage-raw)
ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost"
@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 ${platfdir}/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 ${platfdir}/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
! output sort 19
-$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 20.703314] (1:p0@Tremblay) p0 recv p1 20.703314
> [ 20.703314] (2:p1@Ruby) p1 send p0 1e10 20.703314
> [ 30.897513] (0:maestro@) Simulation time 30.8975
> [ 30.897513] (2:p1@Ruby) p1 compute 1e9 10.194200
! output sort 19
-$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:p0@Tremblay) p0 comm_size 3 0.000000
> [ 1.037020] (1:p0@Tremblay) p0 bcast 5e8 1.037020
> [ 1.037020] (2:p1@Ruby) p1 bcast 5e8 1.037020
! output sort 19
-$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${srcdir:=.}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${platfdir}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:p0@denise) p0 open /home/lib/libsimgrid.so.3.6.2 0.000000
> [ 0.063552] (1:p0@denise) p0 read /home/lib/libsimgrid.so.3.6.2 12710497 0.063552
> [ 0.063552] (1:p0@denise) p0 close /home/lib/libsimgrid.so.3.6.2 0.000000
! timeout 10
! output sort 19
-$ ${bindir:=.}/bittorrent ${srcdir:=.}/cluster.xml app-bittorrent_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/bittorrent ${platfdir}/cluster.xml app-bittorrent_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:tracker@node-0.acme.org) Tracker launched.
> [ 0.000000] (2:peer@node-1.acme.org) Hi, I'm joining the network with id 2
> [ 0.000000] (3:peer@node-2.acme.org) Hi, I'm joining the network with id 3