Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add the capacity the update the priority of an I/O during its execution
[simgrid.git] / src / kernel / activity / IoImpl.hpp
1 /* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_KERNEL_ACTIVITY_IO_HPP
7 #define SIMGRID_KERNEL_ACTIVITY_IO_HPP
8
9 #include "src/kernel/activity/ActivityImpl.hpp"
10 #include <simgrid/s4u/Io.hpp>
11
12 namespace simgrid {
13 namespace kernel {
14 namespace activity {
15
16 class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
17   resource::DiskImpl* disk_           = nullptr;
18   double sharing_penalty_             = 1.0;
19   sg_size_t size_                     = 0;
20   s4u::Io::OpType type_               = s4u::Io::OpType::READ;
21   sg_size_t performed_ioops_          = 0;
22   resource::Action* timeout_detector_ = nullptr;
23   s4u::Io* piface_;
24
25 public:
26   IoImpl();
27   s4u::Io* get_iface() { return piface_; }
28
29   IoImpl& set_sharing_penalty(double sharing_penalty);
30   IoImpl& set_timeout(double timeout) override;
31   IoImpl& set_size(sg_size_t size);
32   IoImpl& set_type(s4u::Io::OpType type);
33   IoImpl& set_disk(resource::DiskImpl* disk);
34
35   IoImpl& update_sharing_penalty(double sharing_penalty);
36
37   sg_size_t get_performed_ioops() const { return performed_ioops_; }
38   resource::DiskImpl* get_disk() const { return disk_; }
39
40   IoImpl* start();
41   void post() override;
42   void finish() override;
43   static void wait_any_for(actor::ActorImpl* issuer, const std::vector<IoImpl*>& ios, double timeout);
44 };
45 } // namespace activity
46 } // namespace kernel
47 } // namespace simgrid
48
49 #endif