A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use auto return type deduction.
[simgrid.git]
/
src
/
surf
/
cpu_interface.hpp
diff --git
a/src/surf/cpu_interface.hpp
b/src/surf/cpu_interface.hpp
index
4b273c7
..
37202d3
100644
(file)
--- a/
src/surf/cpu_interface.hpp
+++ b/
src/surf/cpu_interface.hpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2004-20
19
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-20
21
. 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. */
/* 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 "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>
#include <list>
@@
-28,7
+27,7
@@
namespace resource {
*/
class XBT_PUBLIC CpuModel : public Model {
public:
*/
class XBT_PUBLIC CpuModel : public Model {
public:
- explicit CpuModel(Model::UpdateAlgo algo) : Model(algo) {}
+ using Model::Model;
/**
* @brief Create a Cpu
/**
* @brief Create a Cpu
@@
-48,6
+47,8
@@
public:
* Resource *
************/
* Resource *
************/
+class CpuAction;
+
/** @ingroup SURF_cpu_interface
* @brief SURF cpu resource interface class
* @details A Cpu represent a cpu associated to a host
/** @ingroup SURF_cpu_interface
* @brief SURF cpu resource interface class
* @details A Cpu represent a cpu associated to a host
@@
-55,8
+56,10
@@
public:
class XBT_PUBLIC Cpu : public Resource {
int core_count_ = 1;
s4u::Host* host_;
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:
/**
public:
/**
@@
-90,7
+93,7
@@
public:
* @param size The value of the processing amount (in flop) needed to process
* @return The CpuAction corresponding to the processing
*/
* @param size The value of the processing amount (in flop) needed to process
* @return The CpuAction corresponding to the processing
*/
- virtual Action* execution_start(double size) = 0;
+ virtual
Cpu
Action* execution_start(double size) = 0;
/**
* @brief Execute some quantity of computation on more than one core
/**
* @brief Execute some quantity of computation on more than one core
@@
-99,7
+102,7
@@
public:
* @param requested_cores The desired amount of cores. Must be >= 1
* @return The CpuAction corresponding to the processing
*/
* @param requested_cores The desired amount of cores. Must be >= 1
* @return The CpuAction corresponding to the processing
*/
- virtual Action* execution_start(double size, int requested_cores) = 0;
+ virtual
Cpu
Action* execution_start(double size, int requested_cores) = 0;
/**
* @brief Make a process sleep for duration (in seconds)
/**
* @brief Make a process sleep for duration (in seconds)
@@
-107,7
+110,7
@@
public:
* @param duration The number of seconds to sleep
* @return The CpuAction corresponding to the sleeping
*/
* @param duration The number of seconds to sleep
* @return The CpuAction corresponding to the sleeping
*/
- virtual Action* sleep(double duration) = 0;
+ virtual
Cpu
Action* sleep(double duration) = 0;
/** @brief Get the amount of cores */
virtual int get_core_count();
/** @brief Get the amount of cores */
virtual int get_core_count();
@@
-127,6
+130,13
@@
protected:
/** @brief Take speed changes (either load or max) into account */
virtual void on_speed_change();
/** @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.
*
public:
/** @brief Get the available speed ratio, between 0 and 1.
*
@@
-166,8
+176,7
@@
public:
*/
static xbt::signal<void(CpuAction const&, Action::State)> on_state_change;
*/
static xbt::signal<void(CpuAction const&, Action::State)> on_state_change;
- CpuAction(Model* model, double cost, bool failed) : Action(model, cost, failed) {}
- CpuAction(Model* model, double cost, bool failed, lmm::Variable* var) : Action(model, cost, failed, var) {}
+ using Action::Action;
void set_state(Action::State state) override;
void set_state(Action::State state) override;