Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
5b537ef58aa2be53d06f0123340eab5a7fd14ef4
[simgrid.git] / src / surf / disk_s19.hpp
1 /* Copyright (c) 2013-2019. 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 #include <xbt/base.h>
7
8 #include "src/kernel/resource/DiskImpl.hpp"
9
10 #ifndef DISK_S19_HPP_
11 #define DISK_S19_HPP_
12
13 namespace simgrid {
14 namespace kernel {
15 namespace resource {
16
17 /***********
18  * Classes *
19  ***********/
20
21 class XBT_PRIVATE DiskS19Model;
22 class XBT_PRIVATE DiskS19;
23 class XBT_PRIVATE DiskS19Action;
24
25 /*********
26  * Model *
27  *********/
28
29 class DiskS19Model : public DiskModel {
30 public:
31   DiskS19Model();
32   DiskImpl* createDisk(const std::string& id, double read_bw, double write_bw) override;
33   double next_occuring_event(double now) override;
34   void update_actions_state(double now, double delta) override;
35 };
36
37 /************
38  * Resource *
39  ************/
40
41 class DiskS19 : public DiskImpl {
42 public:
43   DiskS19(DiskModel* model, const std::string& name, kernel::lmm::System* maxminSystem, double read_bw,
44           double write_bw);
45   virtual ~DiskS19() = default;
46   DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) override;
47   DiskAction* read(sg_size_t size) override;
48   DiskAction* write(sg_size_t size) override;
49 };
50
51 /**********
52  * Action *
53  **********/
54
55 class DiskS19Action : public DiskAction {
56 public:
57   DiskS19Action(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type);
58   void suspend() override;
59   void cancel() override;
60   void resume() override;
61   void set_max_duration(double duration) override;
62   void set_sharing_penalty(double sharing_penalty) override;
63   void update_remains_lazy(double now) override;
64 };
65
66 } // namespace resource
67 } // namespace kernel
68 } // namespace simgrid
69 #endif /* DISK_S19_HPP_ */