Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the argc/argv version of simcall_process_create
[simgrid.git] / src / surf / host_clm03.cpp
1 /* Copyright (c) 2013-2018. 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 "src/surf/host_clm03.hpp"
7 #include "simgrid/sg_config.hpp"
8 #include "surf/surf.hpp"
9
10 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
11
12 void surf_host_model_init_current_default()
13 {
14   surf_host_model = new simgrid::surf::HostCLM03Model();
15   simgrid::config::set_default<bool>("network/crosstraffic", true);
16   surf_cpu_model_init_Cas01();
17   surf_network_model_init_LegrandVelho();
18 }
19
20 void surf_host_model_init_compound()
21 {
22   xbt_assert(surf_cpu_model_pm, "No CPU model defined yet!");
23   xbt_assert(surf_network_model, "No network model defined yet!");
24   surf_host_model = new simgrid::surf::HostCLM03Model();
25 }
26
27 namespace simgrid {
28 namespace surf {
29 HostCLM03Model::HostCLM03Model()
30 {
31   all_existing_models.push_back(this);
32 }
33 double HostCLM03Model::next_occuring_event(double now)
34 {
35   ignore_empty_vm_in_pm_LMM();
36
37   double min_by_cpu = surf_cpu_model_pm->next_occuring_event(now);
38   double min_by_net =
39       surf_network_model->next_occuring_event_is_idempotent() ? surf_network_model->next_occuring_event(now) : -1;
40   double min_by_sto = surf_storage_model->next_occuring_event(now);
41
42   XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
43       this, typeid(surf_cpu_model_pm).name(), min_by_cpu,
44       typeid(surf_network_model).name(), min_by_net,
45       typeid(surf_storage_model).name(), min_by_sto);
46
47   double res = min_by_cpu;
48   if (res < 0 || (min_by_net >= 0.0 && min_by_net < res))
49     res = min_by_net;
50   if (res < 0 || (min_by_sto >= 0.0 && min_by_sto < res))
51     res = min_by_sto;
52   return res;
53 }
54
55 void HostCLM03Model::update_actions_state(double /*now*/, double /*delta*/)
56 {
57   /* I've no action to update */
58 }
59
60 }
61 }