/* - For each disk mounted on host, display disk name and mount point */
for (auto disk : disk_list)
- XBT_INFO("Disk name: %s", disk->get_cname());
+ XBT_INFO("Disk name: %s (read: %.0f B/s -- write: %.0f B/s ", disk->get_cname(), disk->get_read_bandwidth(),
+ disk->get_write_bandwidth());
/* - Write 400,000 bytes on Disk1 */
simgrid::s4u::Disk* disk = disk_list.front();
> [ 0.000000] (0:maestro@) *** carl properties ****
> [ 0.000000] (0:maestro@) remote_disk -> /scratch:Disk1:bob
> [ 0.000000] (1:@bob) *** Storage info on bob ***
-> [ 0.000000] (1:@bob) Disk name: Disk1
-> [ 0.000000] (1:@bob) Disk name: Disk2
+> [ 0.000000] (1:@bob) Disk name: Disk1 (read: 100000000 B/s -- write: 40000000 B/s
+> [ 0.000000] (1:@bob) Disk name: Disk2 (read: 200000000 B/s -- write: 80000000 B/s
> [ 0.010000] (1:@bob) Wrote 400000 bytes on 'Disk1'
> [ 0.012000] (1:@bob) Read 200000 bytes on 'Disk1'
> [ 0.012000] (1:@bob) *** Get/set data for storage element: Disk1 ***
*/
class XBT_PUBLIC Disk : public xbt::Extendable<Disk> {
+ kernel::resource::DiskImpl* const pimpl_;
+ std::string name_;
friend Engine;
friend Io;
friend kernel::resource::DiskImpl;
-public:
- explicit Disk(const std::string& name, kernel::resource::DiskImpl* pimpl) : pimpl_(pimpl), name_(name) {}
-
protected:
virtual ~Disk() = default;
public:
+ explicit Disk(const std::string& name, kernel::resource::DiskImpl* pimpl) : pimpl_(pimpl), name_(name) {}
+
/** @brief Callback signal fired when a new Disk is created */
static xbt::signal<void(Disk&)> on_creation;
/** @brief Callback signal fired when a Disk is destroyed */
std::string const& get_name() const { return name_; }
/** @brief Retrieves the name of that disk as a C string */
const char* get_cname() const { return name_.c_str(); }
-
+ double get_read_bandwidth() const;
+ double get_write_bandwidth();
const std::unordered_map<std::string, std::string>* get_properties() const;
const char* get_property(const std::string& key) const;
void set_property(const std::string&, const std::string& value);
IoPtr write_async(sg_size_t size);
sg_size_t write(sg_size_t size);
kernel::resource::DiskImpl* get_impl() const { return pimpl_; }
-
-private:
- kernel::resource::DiskImpl* const pimpl_;
- std::string name_;
};
} // namespace s4u
DiskImpl::DiskImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxminSystem,
double read_bw, double write_bw)
- : Resource(model, name, maxminSystem->constraint_new(this, std::max(read_bw, write_bw))), piface_(name, this)
+ : Resource(model, name, maxminSystem->constraint_new(this, std::max(read_bw, write_bw)))
+ , piface_(name, this)
+ , read_bw_(read_bw)
+ , write_bw_(write_bw)
{
DiskImpl::turn_on();
- XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw, write_bw);
+ XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw_, write_bw_);
constraint_read_ = maxminSystem->constraint_new(this, read_bw);
constraint_write_ = maxminSystem->constraint_new(this, write_bw);
}
bool currently_destroying_ = false;
s4u::Host* host_ = nullptr;
s4u::Disk piface_;
+ double read_bw_;
+ double write_bw_;
public:
DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
/** @brief Public interface */
s4u::Disk* get_iface() { return &piface_; }
+ double get_read_bandwidth() { return read_bw_; }
+ double get_write_bandwidth() { return write_bw_; }
+
/** @brief Check if the Storage is used (if an action currently uses its resources) */
bool is_used() override;
xbt::signal<void(Disk const&)> Disk::on_destruction;
xbt::signal<void(Disk const&)> Disk::on_state_change;
+double Disk::get_read_bandwidth() const
+{
+ return this->pimpl_->get_read_bandwidth();
+}
+
+double Disk::get_write_bandwidth()
+{
+ return pimpl_->get_write_bandwidth();
+}
+
Host* Disk::get_host()
{
return pimpl_->get_host();