*/
XBT_PUBLIC void surf_cpu_model_init_Cas01();
-/** \ingroup SURF_models
- * \brief Initializes the CPU model with trace integration [Deprecated]
- *
- * You shouldn't have to call it by yourself.
- */
-XBT_PUBLIC void surf_cpu_model_init_ti();
-
/** \ingroup SURF_models
* \brief The list of all available optimization modes (both for cpu and networks).
* These optimization modes can be set using --cfg=cpu/optim:... and --cfg=network/optim:...
#include "cpu_cas01.hpp"
#include "simgrid/sg_config.hpp"
+#include "src/surf/cpu_ti.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
*********/
void surf_cpu_model_init_Cas01()
{
- xbt_assert(not surf_cpu_model_pm);
- xbt_assert(not surf_cpu_model_vm);
+ xbt_assert(surf_cpu_model_pm == nullptr, "CPU model already initialized. This should not happen.");
+ xbt_assert(surf_cpu_model_vm == nullptr, "CPU model already initialized. This should not happen.");
if (cpu_optim_opt == "TI") {
- surf_cpu_model_init_ti();
+ simgrid::surf::CpuTiModel::create_pm_vm_models();
return;
}
#include "src/surf/trace_mgr.hpp"
#include "surf/surf.hpp"
-#ifndef SURF_MODEL_CPUTI_H_
-#define SURF_MODEL_CPUTI_H_
+#define EPSILON 0.000000001
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf_cpu, "Logging specific to the SURF CPU TRACE INTEGRATION module");
/*********
* Model *
*********/
+namespace simgrid {
+namespace surf {
-void surf_cpu_model_init_ti()
+void CpuTiModel::create_pm_vm_models()
{
- xbt_assert(not surf_cpu_model_pm, "CPU model already initialized. This should not happen.");
- xbt_assert(not surf_cpu_model_vm, "CPU model already initialized. This should not happen.");
+ xbt_assert(surf_cpu_model_pm == nullptr, "CPU model already initialized. This should not happen.");
+ xbt_assert(surf_cpu_model_vm == nullptr, "CPU model already initialized. This should not happen.");
surf_cpu_model_pm = new simgrid::surf::CpuTiModel();
- all_existing_models->push_back(surf_cpu_model_pm);
-
surf_cpu_model_vm = new simgrid::surf::CpuTiModel();
- all_existing_models->push_back(surf_cpu_model_vm);
}
-namespace simgrid {
-namespace surf {
+CpuTiModel::CpuTiModel() : CpuModel(Model::UpdateAlgo::FULL)
+{
+ all_existing_models->push_back(this);
+}
CpuTiModel::~CpuTiModel()
{
}
}
-
-#endif /* SURF_MODEL_CPUTI_H_ */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#ifndef SURF_MODEL_CPUTI_H_
+#define SURF_MODEL_CPUTI_H_
+
#include <boost/intrusive/list.hpp>
-#include <xbt/base.h>
+//#include <xbt/base.h>
#include "src/surf/cpu_interface.hpp"
#include "src/surf/trace_mgr.hpp"
-/* Epsilon */
-#define EPSILON 0.000000001
-
namespace simgrid {
namespace surf {
*********/
class CpuTiModel : public CpuModel {
public:
- CpuTiModel() : CpuModel(Model::UpdateAlgo::FULL){};
+ static void create_pm_vm_models(); // Make both models be TI models
+
+ CpuTiModel();
~CpuTiModel() override;
Cpu* create_cpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core) override;
double next_occuring_event(double now) override;
}
}
+
+#endif /* SURF_MODEL_CPUTI_H_ */