Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
41b06ef8004c01f9f3326e157b4315826ea1335a
[simgrid.git] / src / surf / vm_hl13.hpp
1 /* Copyright (c) 2013-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "host_clm03.hpp"
8 #include "vm_interface.hpp"
9
10 #ifndef SURF_VM_HPP_
11 #define SURF_VM_HPP_
12
13 #define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM
14                           // It corresponds to the cost of a VM running no tasks.
15
16 /***********
17  * Classes *
18  ***********/
19
20 class VMHL13Model;
21 class VMHL13;
22
23 /*********
24  * Model *
25  *********/
26 class VMHL13Model : public VMModel {
27 public:
28   VMHL13Model();
29   ~VMHL13Model(){};
30
31   VM *createVM(const char *name, surf_resource_t host_PM);
32   double shareResources(double now);
33   void adjustWeightOfDummyCpuActions() {};
34   Action *communicate(Host *src, Host *dst, double size, double rate);
35   Action *executeParallelTask(int host_nb,
36                                           void **host_list,
37                                           double *flops_amount,
38                                           double *bytes_amount,
39                                           double rate);
40   void updateActionsState(double /*now*/, double /*delta*/);
41 };
42
43 /************
44  * Resource *
45  ************/
46
47 class VMHL13 : public VM {
48 public:
49   VMHL13(VMModel *model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
50   ~VMHL13();
51
52   void suspend();
53   void resume();
54
55   void save();
56   void restore();
57
58   void migrate(surf_resource_t ind_dst_pm);
59
60   e_surf_resource_state_t getState();
61   void setState(e_surf_resource_state_t state);
62
63   surf_resource_t getPm(); // will be vm_ws_get_pm()
64
65   void setBound(double bound);
66   void setAffinity(Cpu *cpu, unsigned long mask);
67
68   //FIXME: remove
69   void updateState(tmgr_trace_event_t event_type, double value, double date);
70   bool isUsed();
71
72   Action *execute(double size);
73   Action *sleep(double duration);
74 };
75
76 /**********
77  * Action *
78  **********/
79
80 #endif /* SURF_VM_HPP_ */