/* 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. */
+#include <list>
+
+#include <xbt/base.h>
+#include <xbt/dynar.h>
+#include <xbt/signal.hpp>
+
+#include <simgrid/forward.h>
+#include <simgrid/s4u/host.hpp>
+
+#include "surf/datatypes.h"
#include "surf_interface.hpp"
#include "maxmin_private.hpp"
+#include "trace_mgr.hpp"
#ifndef SURF_CPU_INTERFACE_HPP_
#define SURF_CPU_INTERFACE_HPP_
class CpuModel;
class Cpu;
class CpuAction;
-class CpuPlugin;
-
-/*************
- * Callbacks *
- *************/
-XBT_PUBLIC(std::list<Cpu*>) getActionCpus(CpuAction *action);
-
-/*********
- * Model *
- *********/
+class CpuPlugin;// FIXME:DEADCODE
/** @ingroup SURF_cpu_interface
* @brief SURF cpu model interface class
XBT_PUBLIC_CLASS CpuModel : public Model {
public:
CpuModel() : Model() {};
+ ~CpuModel() override;
/**
* @brief Create a Cpu
*/
virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)=0;
- void updateActionsStateLazy(double now, double delta);
- void updateActionsStateFull(double now, double delta);
- bool next_occuring_event_isIdempotent() {return true;}
+ void updateActionsStateLazy(double now, double delta) override;
+ void updateActionsStateFull(double now, double delta) override;
+ bool next_occuring_event_isIdempotent() override;
};
/************
/** @brief Get the available speed of the current Cpu */
virtual double getAvailableSpeed();
- /** @brief Get the current Cpu power peak */
- virtual double getCurrentPowerPeak();
-
- virtual double getPowerPeakAt(int pstate_index);
+ /** @brief Get the current Cpu computational speed */
+ virtual double getPstateSpeedCurrent();
+ virtual double getPstateSpeed(int pstate_index);
virtual int getNbPStates();
virtual void setPState(int pstate_index);
int coresAmount_ = 1;
simgrid::s4u::Host* host_;
- xbt_dynar_t speedPerPstate_ = NULL; /*< List of supported CPU capacities (pstate related) */
+ xbt_dynar_t speedPerPstate_ = nullptr; /*< List of supported CPU capacities (pstate related) */
int pstate_ = 0; /*< Current pstate (index in the speedPeakList)*/
/* Note (hypervisor): */
- lmm_constraint_t *p_constraintCore=NULL;
- void **p_constraintCoreId=NULL;
+ lmm_constraint_t *p_constraintCore=nullptr;
+ void **p_constraintCoreId=nullptr;
public:
virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values (0 or 1). */
friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
public:
/** @brief Callbacks handler which emit the callbacks after CpuAction State changed *
- * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t previous)`
+ * @details Callback functions have the following signature: `void(CpuAction *action, simgrid::surf::Action::State previous)`
*/
- static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t)> onStateChange;
+ static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, simgrid::surf::Action::State)> onStateChange;
CpuAction(simgrid::surf::Model *model, double cost, bool failed)
: Action(model, cost, failed) {} //FIXME:DEADCODE?
/** @brief Set the affinity of the current CpuAction */
virtual void setAffinity(Cpu *cpu, unsigned long mask);
- void setState(e_surf_action_state_t state);
+ void setState(simgrid::surf::Action::State state) override;
- void updateRemainingLazy(double now);
+ void updateRemainingLazy(double now) override;
+ std::list<Cpu*> cpus();
};
}