Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sanitize the handling of timeouts in CommImpl, ExecImpl and IoImpl
[simgrid.git] / src / kernel / activity / IoImpl.hpp
1 /* Copyright (c) 2007-2023. 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::kernel::activity {
13
14 class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
15   s4u::Host* host_                    = nullptr;
16   resource::DiskImpl* disk_           = nullptr;
17   s4u::Host* dst_host_                = nullptr;
18   resource::DiskImpl* dst_disk_       = nullptr;
19   double sharing_penalty_             = 1.0;
20   sg_size_t size_                     = 0;
21   s4u::Io::OpType type_               = s4u::Io::OpType::READ;
22   sg_size_t performed_ioops_          = 0;
23
24 public:
25   IoImpl();
26
27   IoImpl& set_sharing_penalty(double sharing_penalty);
28   IoImpl& set_size(sg_size_t size);
29   IoImpl& set_type(s4u::Io::OpType type);
30   IoImpl& set_disk(resource::DiskImpl* disk);
31   IoImpl& set_host(s4u::Host* host);
32   s4u::Host* get_host() const { return host_; }
33   IoImpl& set_dst_disk(resource::DiskImpl* disk);
34   IoImpl& set_dst_host(s4u::Host* host);
35   s4u::Host* get_dst_host() const { return dst_host_; }
36
37   IoImpl& update_sharing_penalty(double sharing_penalty);
38
39   sg_size_t get_performed_ioops() const { return performed_ioops_; }
40   resource::DiskImpl* get_disk() const { return disk_; }
41
42   IoImpl* start();
43   void post() override;
44   void set_exception(actor::ActorImpl* issuer) override;
45   void finish() override;
46 };
47 } // namespace simgrid::kernel::activity
48
49 #endif