1 /* Copyright (c) 2013-2018. 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 "host_clm03.hpp"
7 #include "simgrid/sg_config.hpp"
8 #include "surf/surf.hpp"
10 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
20 void surf_host_model_init_current_default()
22 surf_host_model = new simgrid::surf::HostCLM03Model();
23 simgrid::config::set_default<bool>("network/crosstraffic", true);
24 surf_cpu_model_init_Cas01();
25 surf_network_model_init_LegrandVelho();
27 all_existing_models->push_back(surf_host_model);
30 void surf_host_model_init_compound()
32 xbt_assert(surf_cpu_model_pm, "No CPU model defined yet!");
33 xbt_assert(surf_network_model, "No network model defined yet!");
35 surf_host_model = new simgrid::surf::HostCLM03Model();
36 all_existing_models->push_back(surf_host_model);
42 double HostCLM03Model::next_occuring_event(double now)
44 ignore_empty_vm_in_pm_LMM();
46 double min_by_cpu = surf_cpu_model_pm->next_occuring_event(now);
48 surf_network_model->next_occuring_event_is_idempotent() ? surf_network_model->next_occuring_event(now) : -1;
49 double min_by_sto = surf_storage_model->next_occuring_event(now);
51 XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
52 this, typeid(surf_cpu_model_pm).name(), min_by_cpu,
53 typeid(surf_network_model).name(), min_by_net,
54 typeid(surf_storage_model).name(), min_by_sto);
56 double res = std::max({min_by_cpu, min_by_net, min_by_sto});
57 if (min_by_cpu >= 0.0 && min_by_cpu < res)
59 if (min_by_net >= 0.0 && min_by_net < res)
61 if (min_by_sto >= 0.0 && min_by_sto < res)
66 void HostCLM03Model::update_actions_state(double /*now*/, double /*delta*/)
68 /* I won't do what you tell me */