-/* Copyright (c) 2019-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2019-2022. 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 "simgrid/s4u/Disk.hpp"
-#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Host.hpp"
-#include "simgrid/s4u/Io.hpp"
-#include "simgrid/simix.hpp"
+#include <simgrid/s4u/Disk.hpp>
+#include <simgrid/s4u/Io.hpp>
+#include <simgrid/simix.hpp>
+
#include "src/kernel/resource/DiskImpl.hpp"
namespace simgrid {
return pimpl_->get_read_bandwidth();
}
+Disk* Disk::set_readwrite_bandwidth(double bw)
+{
+ kernel::actor::simcall([this, bw] { pimpl_->set_readwrite_bandwidth(bw); });
+ return this;
+}
+
double Disk::get_write_bandwidth() const
{
return pimpl_->get_write_bandwidth();
return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start()->wait()->get_performed_ioops();
}
+sg_size_t Disk::read(sg_size_t size, double priority) const
+{
+ return IoPtr(io_init(size, Io::OpType::READ))
+ ->set_priority(priority)
+ ->vetoable_start()
+ ->wait()
+ ->get_performed_ioops();
+}
+
IoPtr Disk::write_async(sg_size_t size) const
{
return IoPtr(io_init(size, Io::OpType::WRITE)->vetoable_start());
return IoPtr(io_init(size, Io::OpType::WRITE))->vetoable_start()->wait()->get_performed_ioops();
}
+sg_size_t Disk::write(sg_size_t size, double priority) const
+{
+ return IoPtr(io_init(size, Io::OpType::WRITE))
+ ->set_priority(priority)
+ ->vetoable_start()
+ ->wait()
+ ->get_performed_ioops();
+}
+
Disk* Disk::set_sharing_policy(Disk::Operation op, Disk::SharingPolicy policy, const NonLinearResourceCb& cb)
{
kernel::actor::simcall([this, op, policy, &cb] { pimpl_->set_sharing_policy(op, policy, cb); });
Disk* Disk::seal()
{
kernel::actor::simcall([this]{ pimpl_->seal(); });
- Disk::on_creation(*this);
+ Disk::on_creation(*this); // notify the signal
return this;
}
} // namespace s4u