Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MASSIVE cleanup: s/workstation/host/
[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 typedef VMHL13Model *VMHL13ModelPtr;
22
23 class VMHL13;
24 typedef VMHL13 *VMHL13Ptr;
25
26 /*********
27  * Model *
28  *********/
29 class VMHL13Model : public VMModel {
30 public:
31   VMHL13Model();
32   ~VMHL13Model(){};
33
34   VMPtr createVM(const char *name, surf_resource_t host_PM);
35   double shareResources(double now);
36   void adjustWeightOfDummyCpuActions() {};
37   ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
38   ActionPtr executeParallelTask(int host_nb,
39                                           void **host_list,
40                                           double *flops_amount,
41                                           double *bytes_amount,
42                                           double rate);
43   void updateActionsState(double /*now*/, double /*delta*/);
44 };
45
46 /************
47  * Resource *
48  ************/
49
50 class VMHL13 : public VM {
51 public:
52   VMHL13(VMModelPtr model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
53   ~VMHL13();
54
55   void suspend();
56   void resume();
57
58   void save();
59   void restore();
60
61   void migrate(surf_resource_t ind_dst_pm);
62
63   e_surf_resource_state_t getState();
64   void setState(e_surf_resource_state_t state);
65
66   surf_resource_t getPm(); // will be vm_ws_get_pm()
67
68   void setBound(double bound);
69   void setAffinity(CpuPtr cpu, unsigned long mask);
70
71   //FIXME: remove
72   void updateState(tmgr_trace_event_t event_type, double value, double date);
73   bool isUsed();
74
75   ActionPtr execute(double size);
76   ActionPtr sleep(double duration);
77 };
78
79 /**********
80  * Action *
81  **********/
82
83 #endif /* SURF_VM_HPP_ */