Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ns3: Fix a debug message (s/socket/flow/)
[simgrid.git] / src / surf / cpu_interface.hpp
index a011ad3..0215897 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2020. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -10,7 +10,6 @@
 #include "simgrid/kernel/resource/Resource.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/resource/profile/trace_mgr.hpp"
 
 #include <list>
 
@@ -57,8 +56,10 @@ class CpuAction;
 class XBT_PUBLIC Cpu : public Resource {
   int core_count_ = 1;
   s4u::Host* host_;
-  int pstate_ = 0;                             /*< Current pstate (index in the speed_per_pstate_)*/
-  const std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
+  int pstate_ = 0;                       /*< Current pstate (index in the speed_per_pstate_)*/
+  std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related). Not 'const' because VCPU
+                                            get modified on migration */
+  friend simgrid::vm::VirtualMachineImpl; // Resets the VCPU
 
 public:
   /**
@@ -129,6 +130,13 @@ protected:
   /** @brief Take speed changes (either load or max) into account */
   virtual void on_speed_change();
 
+  /** Reset most characteristics of this CPU to the one of that CPU.
+   *
+   * Used to reset a VCPU when its VM migrates to another host, so it only resets the fields that should be in this
+   *case.
+   **/
+  virtual void reset_vcpu(Cpu* that);
+
 public:
   /** @brief Get the available speed ratio, between 0 and 1.
    *