const std::unordered_map<std::string, std::string>* get_properties() const;
Host* set_properties(const std::unordered_map<std::string, std::string>& properties);
- void set_state_profile(kernel::profile::Profile* p);
- void set_speed_profile(kernel::profile::Profile* p);
+ Host* set_state_profile(kernel::profile::Profile* p);
+ Host* set_speed_profile(kernel::profile::Profile* p);
/** @brief Get the peak computing speed in flops/s at the current pstate, NOT taking the external load into account.
*
*/
double get_load() const;
- double get_pstate_speed(int pstate_index) const;
int get_pstate_count() const;
- void set_pstate(int pstate_index);
int get_pstate() const;
+ double get_pstate_speed(int pstate_index) const;
+ Host* set_pstate(int pstate_index);
std::vector<Disk*> get_disks() const;
Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth);
/** Specify a profile turning the host on and off according to an exhaustive list or a stochastic law.
* The profile must contain boolean values. */
-void Host::set_state_profile(kernel::profile::Profile* p)
+Host* Host::set_state_profile(kernel::profile::Profile* p)
{
- return kernel::actor::simcall([this, p] { pimpl_cpu->set_state_profile(p); });
+ kernel::actor::simcall([this, p] { pimpl_cpu->set_state_profile(p); });
+ return this;
}
/** Specify a profile modeling the external load according to an exhaustive list or a stochastic law.
*
* of the initial value. This means that the actual value is obtained by multiplying the initial value (the peek speed
* at this pstate level) by the rate coming from the profile.
*/
-void Host::set_speed_profile(kernel::profile::Profile* p)
+Host* Host::set_speed_profile(kernel::profile::Profile* p)
{
- return kernel::actor::simcall([this, p] { pimpl_cpu->set_speed_profile(p); });
+ kernel::actor::simcall([this, p] { pimpl_cpu->set_speed_profile(p); });
+ return this;
}
/** @brief Get the peak processor speed (in flops/s), at the specified pstate */
Host* Host::set_core_count(int core_count)
{
- this->pimpl_cpu->set_core_count(core_count);
+ kernel::actor::simcall([this, core_count] { this->pimpl_cpu->set_core_count(core_count); });
return this;
}
/** @brief Set the pstate at which the host should run */
-void Host::set_pstate(int pstate_index)
+Host* Host::set_pstate(int pstate_index)
{
kernel::actor::simcall([this, pstate_index] { this->pimpl_cpu->set_pstate(pstate_index); });
+ return this;
}
+
/** @brief Retrieve the pstate at which the host is currently running */
int Host::get_pstate() const
{
std::vector<Disk*> Host::get_disks() const
{
- return kernel::actor::simcall([this] { return this->pimpl_->get_disks(); });
+ return this->pimpl_->get_disks();
}
Disk* Host::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
this->speed_per_pstate_.assign(that->speed_per_pstate_.begin(), that->speed_per_pstate_.end());
}
-void Cpu::set_pstate(int pstate_index)
+Cpu* Cpu::set_pstate(int pstate_index)
{
xbt_assert(pstate_index <= static_cast<int>(speed_per_pstate_.size()),
"Invalid parameters for CPU %s (pstate %d > length of pstates %d). Please fix your platform file, or your "
speed_.peak = new_peak_speed;
on_speed_change();
+ return this;
}
double Cpu::get_pstate_peak_speed(int pstate_index) const
return core_count_;
}
-void Cpu::set_speed_profile(kernel::profile::Profile* profile)
+Cpu* Cpu::set_speed_profile(kernel::profile::Profile* profile)
{
- xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", piface_->get_cname());
-
- speed_.event = profile->schedule(&profile::future_evt_set, this);
+ if (profile) {
+ xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", piface_->get_cname());
+ speed_.event = profile->schedule(&profile::future_evt_set, this);
+ }
+ return this;
}
void Cpu::seal()
virtual int get_pstate_count() const { return speed_per_pstate_.size(); }
- virtual void set_pstate(int pstate_index);
virtual int get_pstate() const { return pstate_; }
+ virtual Cpu* set_pstate(int pstate_index);
- /*< @brief Setup the trace file with availability events (peak speed changes due to external load).
- * Trace must contain relative values (ratio between 0 and 1)
+ /*< @brief Setup the profile file with availability events (peak speed changes due to external load).
+ * Profile must contain relative values (ratio between 0 and 1)
*/
- virtual void set_speed_profile(profile::Profile* profile);
+ virtual Cpu* set_speed_profile(profile::Profile* profile);
/**
* @brief Execute some quantity of computation
delete speed_integrated_trace_;
}
-void CpuTi::set_speed_profile(kernel::profile::Profile* profile)
+Cpu* CpuTi::set_speed_profile(kernel::profile::Profile* profile)
{
delete speed_integrated_trace_;
speed_integrated_trace_ = new CpuTiTmgr(profile, speed_.scale);
speed_.event = prof->schedule(&profile::future_evt_set, this);
}
}
+ return this;
}
void CpuTi::apply_event(kernel::profile::Event* event, double value)
CpuTi& operator&(const CpuTi&) = delete;
~CpuTi() override;
- void set_speed_profile(profile::Profile* profile) override;
+ Cpu* set_speed_profile(profile::Profile* profile) override;
void apply_event(profile::Event* event, double value) override;
void update_actions_finish_time(double now);
host->pimpl_->set_disks(args->disks, host);
/* Change from the defaults */
- if (args->state_trace)
- host->set_state_profile(args->state_trace);
- if (args->speed_trace)
- host->set_speed_profile(args->speed_trace);
+ host->set_state_profile(args->state_trace)->set_speed_profile(args->speed_trace);
+
if (not args->coord.empty())
new simgrid::kernel::routing::vivaldi::Coords(host->get_netpoint(), args->coord);
> [ 1.207952] (server@alice) /tmp/tata.c size: 6217 bytes
> [ 1.207952] (server@alice) /tmp/titi.xml size: 654 bytes
> [ 1.207952] (server@alice) /tmp/toto.xml size: 972 bytes
+> [ 1.207952] (server@alice) Disk1 is attached to alice
> [ 1.207952] (client@bob) *** GET/SET DATA for disk: Disk1 ***
> [ 1.207952] (client@bob) Get data: 'No User Data'
> [ 1.207952] (client@bob) Set and get data: 'Some data'
-> [ 1.207952] (server@alice) Disk1 is attached to alice
> [ 1.207952] (server@alice) Disk1 is attached to bob
> [ 1.207952] (server@alice) Disk2 is attached to bob
> [ 1.207952] (maestro@) Simulated time: 1.20795