1 /* Copyright (c) 2004-2023. 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 <xbt/asserts.h>
9 #include "src/simgrid/module.hpp"
10 #include "src/surf/surf_interface.hpp"
14 XBT_LOG_NEW_CATEGORY(plugin, "Common category for the logging of all plugins");
15 XBT_LOG_EXTERNAL_CATEGORY(xbt_help);
17 using namespace simgrid;
19 ModuleGroup& ModuleGroup::add(const char* id, const char* desc, std::function<void()> init)
21 table_.emplace_back(Module(id, desc, init));
25 Module const& ModuleGroup::by_name(const std::string& name) const
27 if (auto pos = std::find_if(table_.begin(), table_.end(), [&name](const Module& item) { return item.name_ == name; });
31 xbt_die("Unable to find %s '%s'. Valid values are: %s.", kind_.c_str(), name.c_str(), existing_values().c_str());
33 /** Displays the long description of all registered models, and quit */
34 void ModuleGroup::help() const
36 XBT_HELP("Long description of the %s accepted by this simulator:", kind_.c_str());
37 for (auto const& item : table_)
38 XBT_HELP(" %s: %s", item.name_, item.description_);
40 std::string ModuleGroup::existing_values() const
44 for (auto const& item : table_) {
45 ss << sep + item.name_;
51 /* -------------------------------------------------------------------------------------------------------------- */
52 simgrid::ModuleGroup surf_optimization_mode_description("optimization mode");
53 simgrid::ModuleGroup surf_cpu_model_description("CPU model");
54 simgrid::ModuleGroup surf_disk_model_description("disk model");
55 simgrid::ModuleGroup surf_host_model_description("host model");
57 void simgrid_create_models()
59 surf_cpu_model_description.add("Cas01", "Simplistic CPU model (time=size/speed).", &surf_cpu_model_init_Cas01);
60 surf_disk_model_description.add("S19", "Simplistic disk model.", &surf_disk_model_init_S19);
62 surf_host_model_description
64 "Default host model. Currently, CPU:Cas01, network:LV08 (with cross traffic enabled), and disk:S19",
65 &surf_host_model_init_current_default)
66 .add("compound", "Host model that is automatically chosen if you change the CPU, network, and disk models",
67 &surf_host_model_init_compound)
68 .add("ptask_L07", "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks",
69 &surf_host_model_init_ptask_L07);
71 surf_optimization_mode_description
72 .add("Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr)
74 "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU "
77 .add("Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr);