public:
simgrid::s4u::Host* hostByName(std::string name);
simgrid::s4u::Host* hostByNameOrNull(std::string name);
+
size_t getHostCount();
void getHostList(std::vector<Host*> * whereTo);
std::vector<Host*> getHostList();
+
size_t getLinkCount();
void getLinkList(std::vector<Link*> * list);
+ std::vector<Link*> getLinkList();
/** @brief Run the simulation */
void run();
{
return simgrid::surf::LinkImpl::linksCount();
}
-/** @brief Fills the passed list with all hosts found in the platform */
+/** @brief Fills the passed list with all links found in the platform */
void Engine::getLinkList(std::vector<Link*>* list)
{
simgrid::surf::LinkImpl::linksList(list);
}
+/** @brief Returns the list of all links found in the platform */
+std::vector<Link*> Engine::getLinkList()
+{
+ std::vector<Link*> res;
+ simgrid::surf::LinkImpl::linksList(&res);
+ return res;
+}
void Engine::run() {
if (MC_is_active()) {
static void onSimulationEnd()
{
- std::vector<simgrid::s4u::Link*> links;
- simgrid::s4u::Engine::getInstance()->getLinkList(&links);
+ std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::getInstance()->getLinkList();
double total_energy = 0.0; // Total dissipated energy (whole platform)
for (const auto link : links) {