X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cf108868b4eeed4d0d9d343bc68557d7814e18c0..f3da0e53f20a27db79c661314020550b7b9d0bcd:/src/surf/ptask_L07.hpp diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 1476127cc2..ae232a5223 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -1,16 +1,12 @@ -/* 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. */ #include - #include - #include - -#include "host_interface.hpp" +#include "src/surf/HostImpl.hpp" #ifndef HOST_L07_HPP_ #define HOST_L07_HPP_ @@ -43,43 +39,30 @@ public: ~HostL07Model(); double next_occuring_event(double now) override; - void updateActionsState(double now, double delta) override; - Action *executeParallelTask(int host_nb, sg_host_t *host_list, - double *flops_amount, double *bytes_amount, - double rate) override; + void update_actions_state(double now, double delta) override; + kernel::resource::Action* execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount, + double* bytes_amount, double rate) override; }; class CpuL07Model : public CpuModel { public: - CpuL07Model(HostL07Model *hmodel,lmm_system_t sys); + CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys); ~CpuL07Model(); - Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, - int pstate, double speedScale, - tmgr_trace_t speedTrace, int core, - int initiallyOn, - tmgr_trace_t state_trace) override; - HostL07Model *p_hostModel; + Cpu *createCpu(simgrid::s4u::Host *host, std::vector *speedPerPstate, int core) override; + HostL07Model *hostModel_; }; -class NetworkL07Model : public NetworkModel { +class NetworkL07Model : public kernel::resource::NetworkModel { public: - NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys); + NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys); ~NetworkL07Model(); - Link* createLink(const char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - int initiallyOn, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy, - xbt_dict_t properties) override; - - Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override; - bool next_occuring_event_isIdempotent() override {return true;} - - HostL07Model *p_hostModel; + kernel::resource::LinkImpl* createLink(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) override; + + kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; + + HostL07Model *hostModel_; }; /************ @@ -88,33 +71,31 @@ public: class CpuL07 : public Cpu { public: - CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, int pstate, - double power_scale, tmgr_trace_t power_trace, - int core, int initiallyOn, tmgr_trace_t state_trace); - ~CpuL07(); - bool isUsed() override; - void apply_event(tmgr_trace_iterator_t event, double value) override; - Action *execution_start(double size) override; - Action *sleep(double duration) override; + CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector * speedPerPstate, int core); + ~CpuL07() override; + bool is_used() override; + void apply_event(tmgr_trace_event_t event, double value) override; + kernel::resource::Action* execution_start(double size) override; + simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override + { + THROW_UNIMPLEMENTED; + return nullptr; + } + kernel::resource::Action* sleep(double duration) override; + protected: void onSpeedChange() override; }; -class LinkL07 : public Link { +class LinkL07 : public kernel::resource::LinkImpl { public: - LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - int initiallyOn, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy); - ~LinkL07(){ }; - bool isUsed() override; - void apply_event(tmgr_trace_iterator_t event, double value) override; - void updateBandwidth(double value) override; - void updateLatency(double value) override; + LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy); + ~LinkL07() override; + bool is_used() override; + void apply_event(tmgr_trace_event_t event, double value) override; + void setBandwidth(double value) override; + void setLatency(double value) override; }; /********** @@ -123,28 +104,21 @@ public: class L07Action : public CpuAction { friend Action *CpuL07::execution_start(double size); friend Action *CpuL07::sleep(double duration); - friend Action *HostL07Model::executeParallelTask(int host_nb, - sg_host_t*host_list, - double *flops_amount, - double *bytes_amount, - double rate); + friend Action* HostL07Model::execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount, + double* bytes_amount, double rate); + public: - L07Action(Model *model, int host_nb, - sg_host_t*host_list, - double *flops_amount, - double *bytes_amount, - double rate); - ~L07Action(); + L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* host_list, double* flops_amount, + double* bytes_amount, double rate); + ~L07Action(); void updateBound(); - int unref() override; - - std::vector * p_netcardList = new std::vector(); - double *p_computationAmount; - double *p_communicationAmount; - double m_latency; - double m_rate; + std::vector* hostList_ = new std::vector(); + double *computationAmount_; + double *communicationAmount_; + double latency_; + double rate_; }; }