Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / surf / cpu_cas01_private.h
1 /* Copyright (c) 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 _SURF_CPU_CAS01_PRIVATE_H
8 #define _SURF_CPU_CAS01_PRIVATE_H
9
10 #undef GENERIC_LMM_ACTION
11 #undef GENERIC_ACTION
12 #undef ACTION_GET_CPU
13 #define GENERIC_LMM_ACTION(action) action->generic_lmm_action
14 #define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action
15 #define ACTION_GET_CPU(action) ((surf_action_cpu_Cas01_t) action)->cpu
16
17 typedef struct surf_action_cpu_cas01 {
18   s_surf_action_lmm_t generic_lmm_action;
19 } s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
20
21 /*
22  * Energy-related properties for the cpu_cas01 model
23  */
24 typedef struct energy_cpu_cas01 {
25         xbt_dynar_t power_range_watts_list;             /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
26         double total_energy;                                    /*< Total energy consumed by the host */
27         double last_updated;                                    /*< Timestamp of the last energy update event*/
28 } s_energy_cpu_cas01_t, *energy_cpu_cas01_t;
29
30
31 typedef struct cpu_Cas01 {
32   s_surf_resource_t generic_resource;
33   s_xbt_swag_hookup_t modified_cpu_hookup;
34   double power_peak;
35   double power_scale;
36   tmgr_trace_event_t power_event;
37   int core;
38   e_surf_resource_state_t state_current;
39   tmgr_trace_event_t state_event;
40   lmm_constraint_t constraint;
41
42   xbt_dynar_t power_peak_list;                          /*< List of supported CPU capacities */
43   int pstate;                                                           /*< Current pstate (index in the power_peak_list)*/
44   energy_cpu_cas01_t energy;    
45
46   /* Note (hypervisor): */
47   lmm_constraint_t *constraint_core;
48
49 } s_cpu_Cas01_t, *cpu_Cas01_t;
50
51 void *cpu_cas01_create_resource(const char *name,
52         xbt_dynar_t power_peak,
53         int pstate,
54     double power_scale,
55     tmgr_trace_t power_trace,
56     int core,
57     e_surf_resource_state_t state_initial,
58     tmgr_trace_t state_trace,
59     xbt_dict_t cpu_properties,
60     surf_model_t cpu_model);
61
62 xbt_dynar_t cpu_get_watts_range_list(cpu_Cas01_t cpu_model);
63 void cpu_update_energy(cpu_Cas01_t cpu_model, double cpu_load);
64
65 #endif                          /* _SURF_CPU_CAS01_PRIVATE_H */