Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix initialization order.
[simgrid.git] / src / simix / smx_host_private.h
1 /* Copyright (c) 2007-2010, 2012-2013. 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 #ifndef _SIMIX_HOST_PRIVATE_H
8 #define _SIMIX_HOST_PRIVATE_H
9
10 #include "simgrid/simix.h"
11 #include "smx_smurf_private.h"
12
13 /** @brief Host datatype */
14 typedef struct s_smx_host_priv {
15   xbt_swag_t process_list;
16   xbt_dynar_t auto_restart_processes;
17   xbt_dynar_t boot_processes; 
18   void *data;              /**< @brief user data */
19 } s_smx_host_priv_t;
20
21 static inline smx_host_priv_t SIMIX_host_priv(smx_host_t host){
22   return (smx_host_priv_t) xbt_lib_get_level(host, SIMIX_HOST_LEVEL);
23 }
24
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 void _SIMIX_host_free_process_arg(void *);
30 smx_host_t SIMIX_host_create(const char *name, void *workstation, void *data);
31 void SIMIX_host_destroy(void *host);
32
33 void SIMIX_host_add_auto_restart_process(smx_host_t host,
34                                          const char *name,
35                                          xbt_main_func_t code,
36                                          void *data,
37                                          const char *hostname,
38                                          double kill_time,
39                                          int argc, char **argv,
40                                          xbt_dict_t properties,
41                                          int auto_restart);
42
43 void SIMIX_host_restart_processes(smx_host_t host);
44 void SIMIX_host_autorestart(smx_host_t host);
45 xbt_dict_t SIMIX_host_get_properties(smx_host_t host);
46 int SIMIX_host_get_core(smx_host_t host);
47 xbt_swag_t SIMIX_host_get_process_list(smx_host_t host);
48 double SIMIX_host_get_speed(smx_host_t host);
49 double SIMIX_host_get_available_speed(smx_host_t host);
50 int SIMIX_host_get_state(smx_host_t host);
51 void SIMIX_host_on(smx_host_t host);
52 void SIMIX_host_off(smx_host_t host, smx_process_t issuer);
53 double SIMIX_host_get_current_power_peak(smx_host_t host);
54 double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index);
55 int SIMIX_host_get_nb_pstates(smx_host_t host);
56 double SIMIX_host_get_consumed_energy(smx_host_t host);
57 void SIMIX_host_set_power_peak_at(smx_host_t host, int pstate_index);
58 smx_action_t SIMIX_host_execute(const char *name,
59     smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask);
60 smx_action_t SIMIX_host_parallel_execute(const char *name,
61     int host_nb, smx_host_t *host_list,
62     double *computation_amount, double *communication_amount,
63     double amount, double rate);
64 void SIMIX_host_execution_destroy(smx_action_t action);
65 void SIMIX_host_execution_cancel(smx_action_t action);
66 double SIMIX_host_execution_get_remains(smx_action_t action);
67 e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
68 void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
69 void SIMIX_host_execution_set_bound(smx_action_t action, double bound);
70 void SIMIX_host_execution_set_affinity(smx_action_t action, smx_host_t host, unsigned long mask);
71 void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
72 xbt_dict_t SIMIX_host_get_storage_list(smx_host_t host);
73
74 // pre prototypes
75 smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
76 const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
77 const char* SIMIX_pre_host_get_name(smx_simcall_t, smx_host_t);
78 void SIMIX_pre_host_on(smx_simcall_t, smx_host_t host);
79 void SIMIX_pre_host_off(smx_simcall_t, smx_host_t host);
80 xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t, smx_host_t);
81 int SIMIX_pre_host_get_core(smx_simcall_t, smx_host_t);
82 xbt_swag_t SIMIX_pre_host_get_process_list(smx_simcall_t, smx_host_t host);
83 double SIMIX_pre_host_get_speed(smx_simcall_t, smx_host_t);
84 double SIMIX_pre_host_get_available_speed(smx_simcall_t, smx_host_t);
85 int SIMIX_pre_host_get_state(smx_simcall_t, smx_host_t);
86 double SIMIX_pre_host_get_current_power_peak(smx_simcall_t, smx_host_t);
87 double SIMIX_pre_host_get_power_peak_at(smx_simcall_t, smx_host_t host, int pstate_index);
88 int SIMIX_pre_host_get_nb_pstates(smx_simcall_t, smx_host_t host);
89 void SIMIX_pre_host_set_power_peak_at(smx_simcall_t, smx_host_t host, int pstate_index);
90 double SIMIX_pre_host_get_consumed_energy(smx_simcall_t, smx_host_t);
91 void* SIMIX_pre_host_self_get_data(smx_simcall_t);
92 void* SIMIX_pre_host_get_data(smx_simcall_t, smx_host_t);
93 void SIMIX_pre_host_set_data(smx_simcall_t, smx_host_t, void*);
94 smx_action_t SIMIX_pre_host_execute(smx_simcall_t, const char*, smx_host_t, double, double, double, unsigned long);
95 smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t, const char*, int, smx_host_t*,
96                                              double*, double*, double, double);
97 void SIMIX_pre_host_execution_destroy(smx_simcall_t, smx_action_t);
98 void SIMIX_pre_host_execution_cancel(smx_simcall_t, smx_action_t);
99 double SIMIX_pre_host_execution_get_remains(smx_simcall_t, smx_action_t);
100 e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t, smx_action_t);
101 void SIMIX_pre_host_execution_set_priority(smx_simcall_t, smx_action_t, double);
102 void SIMIX_pre_host_execution_set_bound(smx_simcall_t simcall, smx_action_t action, double bound);
103 void SIMIX_pre_host_execution_set_affinity(smx_simcall_t simcall, smx_action_t action, smx_host_t host, unsigned long mask);
104
105 void SIMIX_host_execution_suspend(smx_action_t action);
106 void SIMIX_host_execution_resume(smx_action_t action);
107
108 void SIMIX_post_host_execute(smx_action_t action);
109 xbt_dict_t SIMIX_pre_host_get_storage_list(smx_simcall_t, smx_host_t);
110 #ifdef HAVE_TRACING
111 void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
112                             const char *category);
113 void SIMIX_set_category(smx_action_t action, const char *category);
114 #endif
115 /* vm related stuff */
116 smx_host_t SIMIX_vm_create(const char *name, smx_host_t ind_phys_host);
117 smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host_t ind_phys_host);
118
119 void SIMIX_vm_destroy(smx_host_t ind_vm);
120 void SIMIX_pre_vm_destroy(smx_simcall_t simcall, smx_host_t ind_vm);
121 // --
122 void SIMIX_vm_resume(smx_host_t ind_vm, smx_process_t issuer);
123 void SIMIX_pre_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm);
124
125 void SIMIX_vm_suspend(smx_host_t ind_vm, smx_process_t issuer);
126 void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm);
127 // --
128 void SIMIX_vm_save(smx_host_t ind_vm, smx_process_t issuer);
129 void SIMIX_pre_vm_save(smx_simcall_t simcall, smx_host_t ind_vm);
130
131 void SIMIX_vm_restore(smx_host_t ind_vm, smx_process_t issuer);
132 void SIMIX_pre_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm);
133 // --
134 void SIMIX_vm_start(smx_host_t ind_vm);
135 void SIMIX_pre_vm_start(smx_simcall_t simcall, smx_host_t ind_vm);
136
137 void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer);
138 void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm);
139 // --
140 void SIMIX_vm_set_state(smx_host_t ind_vm, int state);
141 void SIMIX_pre_vm_set_state(smx_simcall_t simcall, smx_host_t ind_vm, int state);
142
143 int SIMIX_vm_get_state(smx_host_t ind_vm);
144 int SIMIX_pre_vm_get_state(smx_simcall_t simcall, smx_host_t ind_vm);
145 // --
146 void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm);
147 void SIMIX_pre_vm_migrate(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_dst_pm);
148
149 void *SIMIX_vm_get_pm(smx_host_t ind_vm);
150 void *SIMIX_pre_vm_get_pm(smx_simcall_t simcall, smx_host_t ind_vm);
151
152 void SIMIX_vm_set_bound(smx_host_t ind_vm, double bound);
153 void SIMIX_pre_vm_set_bound(smx_simcall_t simcall, smx_host_t ind_vm, double bound);
154
155 void SIMIX_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask);
156 void SIMIX_pre_vm_set_affinity(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask);
157
158 void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params);
159 void SIMIX_pre_host_get_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params);
160
161 void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params);
162 void SIMIX_pre_host_set_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params);
163 #ifdef __cplusplus
164 }
165 #endif
166
167 #endif
168