X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/595e59c568ff5f8510de201bfd800951cdc2adcb..8372ae97612f27b84e8d75aeeed9de0ba6d2ba6a:/src/surf/cpu_ti.hpp diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 4059783161..df6c050613 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2013-2018. 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 +9,6 @@ #include "src/surf/cpu_interface.hpp" #include "src/surf/trace_mgr.hpp" -#include "surf/surf_routing.h" /* Epsilon */ #define EPSILON 0.000000001 @@ -21,13 +19,8 @@ namespace surf { /*********** * Classes * ***********/ -class XBT_PRIVATE CpuTiTrace; -class XBT_PRIVATE CpuTiTgmr; class XBT_PRIVATE CpuTiModel; class XBT_PRIVATE CpuTi; -class XBT_PRIVATE CpuTiAction; - -struct tiTag; /********* * Trace * @@ -37,14 +30,14 @@ public: explicit CpuTiTrace(tmgr_trace_t speedTrace); ~CpuTiTrace(); - double integrateSimple(double a, double b); - double integrateSimplePoint(double a); - double solveSimple(double a, double amount); + double integrate_simple(double a, double b); + double integrate_simple_point(double a); + double solve_simple(double a, double amount); - double *timePoints_; + double* time_points_; double *integral_; - int nbPoints_; - int binarySearch(double *array, double a, int low, int high); + int nb_points_; + int binary_search(double* array, double a, int low, int high); }; enum trace_type { @@ -63,18 +56,17 @@ public: double integrate(double a, double b); double solve(double a, double amount); - double solveSomewhatSimple(double a, double amount); - double getPowerScale(double a); + double get_power_scale(double a); trace_type type_; double value_; /*< Percentage of cpu speed available. Value fixed between 0 and 1 */ /* Dynamic */ - double lastTime_ = 0.0; /*< Integral interval last point (discrete time) */ + double last_time_ = 0.0; /*< Integral interval last point (discrete time) */ double total_ = 0.0; /*< Integral total between 0 and last_pointn */ CpuTiTrace *trace_ = nullptr; - tmgr_trace_t speedTrace_ = nullptr; + tmgr_trace_t speed_trace_ = nullptr; }; /********** @@ -85,20 +77,17 @@ class CpuTiAction: public CpuAction { friend class CpuTi; public: CpuTiAction(CpuTiModel *model, double cost, bool failed, CpuTi *cpu); + ~CpuTiAction(); - void setState(simgrid::surf::Action::State state) override; - int unref() override; + void set_state(simgrid::kernel::resource::Action::State state) override; void cancel() override; - void updateIndexHeap(int i); void suspend() override; void resume() override; - void setMaxDuration(double duration) override; - void setPriority(double priority) override; - double getRemains() override; + void set_max_duration(double duration) override; + void set_priority(double priority) override; + double get_remains() override; CpuTi *cpu_; - int indexHeap_ = -1; - int suspended_ = 0; boost::intrusive::list_member_hook<> action_ti_hook; }; @@ -111,28 +100,33 @@ typedef boost::intrusive::list ActionTiList; ************/ class CpuTi : public Cpu { public: - CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, std::vector *speedPerPstate, int core); + CpuTi(CpuTiModel* model, simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core); ~CpuTi() override; - void setSpeedTrace(tmgr_trace_t trace) override; + void set_speed_trace(tmgr_trace_t trace) override; void apply_event(tmgr_trace_event_t event, double value) override; - void updateActionsFinishTime(double now); - void updateRemainingAmount(double now); + void update_actions_finish_time(double now); + void update_remaining_amount(double now); - bool isUsed() override; + bool is_used() override; CpuAction *execution_start(double size) override; + simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override + { + THROW_UNIMPLEMENTED; + return nullptr; + } CpuAction *sleep(double duration) override; - double getAvailableSpeed() override; + double get_available_speed() override; - void modified(bool modified); + void set_modified(bool modified); - CpuTiTgmr *speedIntegratedTrace_ = nullptr;/*< Structure with data needed to integrate trace file */ - ActionTiList *actionSet_ = nullptr; /*< set with all actions running on cpu */ - double sumPriority_ = 0; /*< the sum of actions' priority that are running on cpu */ - double lastUpdate_ = 0; /*< last update of actions' remaining amount done */ + CpuTiTgmr* speed_integrated_trace_ = nullptr; /*< Structure with data needed to integrate trace file */ + ActionTiList action_set_; /*< set with all actions running on cpu */ + double sum_priority_ = 0; /*< the sum of actions' priority that are running on cpu */ + double last_update_ = 0; /*< last update of actions' remaining amount done */ - double currentFrequency_; + double current_frequency_; boost::intrusive::list_member_hook<> cpu_ti_hook; }; @@ -145,23 +139,14 @@ typedef boost::intrusive::list CpuTiList; *********/ class CpuTiModel : public CpuModel { public: - CpuTiModel(); + CpuTiModel() : CpuModel(Model::UpdateAlgo::Full){}; ~CpuTiModel() override; - Cpu *createCpu(simgrid::s4u::Host *host, std::vector* speedPerPstate, int core) override; - double nextOccuringEvent(double now) override; - void updateActionsState(double now, double delta) override; - - ActionList *runningActionSetThatDoesNotNeedBeingChecked_; - CpuTiList *modifiedCpu_; - xbt_heap_t tiActionHeap_; - -protected: - void NotifyResourceTurnedOn(simgrid::surf::Resource*){}; - void NotifyResourceTurnedOff(simgrid::surf::Resource*){}; + Cpu* createCpu(simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core) override; + double next_occuring_event(double now) override; + void update_actions_state(double now, double delta) override; - void NotifyActionCancel(Action*){}; - void NotifyActionResume(Action*){}; - void NotifyActionSuspend(Action*){}; + kernel::resource::Action::StateSet runningActionSetThatDoesNotNeedBeingChecked_; + CpuTiList modified_cpus_; }; }