Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a bit of simplification
[simgrid.git] / src / msg / msg_host.cpp
1 /* Copyright (c) 2004-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/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"
11
12 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
13
14 extern "C" {
15
16 /** @addtogroup m_host_management
17  * (#msg_host_t) and the functions for managing it.
18  *
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.
22  *  \see msg_host_t
23  */
24
25 /********************************* Host **************************************/
26
27 /** \ingroup m_host_management
28  * \brief Return the list of processes attached to an host.
29  *
30  * \param host a host
31  * \param whereto a dynar in which we should push processes living on that host
32  */
33 void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto)
34 {
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);
39   }
40 }
41
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.
44  *
45  * \param  host host to test
46  * \param pstate_index pstate to test
47  * \return Returns the processor speed associated with pstate_index
48  */
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);
52 }
53
54 }