1 /* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
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. */
6 #include "simgrid/s4u/Host.hpp"
7 #include "simgrid/s4u/Storage.hpp"
8 #include "src/msg/msg_private.hpp"
9 #include "src/simix/ActorImpl.hpp"
10 #include "src/simix/smx_host_private.hpp"
12 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
16 /** @addtogroup m_host_management
17 * (#msg_host_t) and the functions for managing it.
19 * A <em>location</em> (or <em>host</em>) is any possible place where a process may run. Thus it may be represented
20 * as a <em>physical resource with computing capabilities</em>, some <em>mailboxes</em> to enable running process to
21 * communicate with remote ones, and some <em>private data</em> that can be only accessed by local process.
25 /********************************* Host **************************************/
27 /** \ingroup m_host_management
28 * \brief Return the list of processes attached to an host.
31 * \param whereto a dynar in which we should push processes living on that host
33 void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto)
35 xbt_assert((host != nullptr), "Invalid parameters");
36 for (auto& actor : host->extension<simgrid::simix::Host>()->process_list) {
37 msg_process_t p = actor.ciface();
38 xbt_dynar_push(whereto, &p);
42 /** \ingroup m_host_management
43 * \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
45 * \param host host to test
46 * \param pstate_index pstate to test
47 * \return Returns the processor speed associated with pstate_index
49 double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
50 xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
51 return host->getPstateSpeed(pstate_index);