Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set cfg=smpi/simulate-computation:no.
[simgrid.git] / src / surf / cpu_ti.hpp
index 42c1045..2bcdfab 100644 (file)
@@ -10,6 +10,7 @@
 #include "src/surf/cpu_interface.hpp"
 
 #include <boost/intrusive/list.hpp>
+#include <memory>
 
 namespace simgrid {
 namespace kernel {
@@ -27,18 +28,14 @@ class XBT_PRIVATE CpuTi;
 class CpuTiProfile {
 public:
   explicit CpuTiProfile(profile::Profile* profile);
-  CpuTiProfile(const CpuTiProfile&) = delete;
-  CpuTiProfile& operator=(const CpuTiProfile&) = delete;
-  ~CpuTiProfile();
 
   double integrate_simple(double a, double b);
   double integrate_simple_point(double a);
   double solve_simple(double a, double amount);
 
-  double* time_points_;
-  double *integral_;
-  int nb_points_;
-  static int binary_search(double* array, double a, int size);
+  std::vector<double> time_points_;
+  std::vector<double> integral_;
+  static int binary_search(const std::vector<double>& array, double a);
 };
 
 class CpuTiTmgr {
@@ -52,7 +49,6 @@ public:
   CpuTiTmgr(profile::Profile* speed_profile, double value);
   CpuTiTmgr(const CpuTiTmgr&) = delete;
   CpuTiTmgr& operator=(const CpuTiTmgr&) = delete;
-  ~CpuTiTmgr();
 
   double integrate(double a, double b);
   double solve(double a, double amount);
@@ -66,8 +62,8 @@ private:
   double last_time_ = 0.0;             /*< Integral interval last point (discrete time) */
   double total_    = 0.0;             /*< Integral total between 0 and last_pointn */
 
-  CpuTiProfile* profile_                   = nullptr;
-  profile::Profile* speed_profile_         = nullptr;
+  std::unique_ptr<CpuTiProfile> profile_ = nullptr;
+  profile::Profile* speed_profile_       = nullptr;
 };
 
 /**********