Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Put ns3 sources in place.
[simgrid.git] / src / surf / cpu_ti_private.h
1
2 /* Copyright (c) 2009, 2010. The SimGrid Team.
3  * All rights reserved.                                                     */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef _SURF_CPU_TI_PRIVATE_H
9 #define _SURF_CPU_TI_PRIVATE_H
10
11 typedef struct surf_cpu_ti_trace {
12   double *time_points;
13   double *integral;
14   int nb_points;
15 } s_surf_cpu_ti_trace_t, *surf_cpu_ti_trace_t;
16
17 /* TRACE */
18 typedef struct surf_cpu_ti_tgmr {
19   enum trace_type {
20     TRACE_FIXED,                /*< Trace fixed, no availability file */
21     TRACE_DYNAMIC               /*< Dynamic, availability file disponible */
22   } type;
23
24   double value;                 /*< Percentage of cpu power disponible. Value fixed between 0 and 1 */
25
26   /* Dynamic */
27   double last_time;             /*< Integral interval last point (discret time) */
28   double total;                 /*< Integral total between 0 and last_pointn */
29
30   surf_cpu_ti_trace_t trace;
31   tmgr_trace_t power_trace;
32
33 } s_surf_cpu_ti_tgmr_t, *surf_cpu_ti_tgmr_t;
34
35
36 /* CPU with trace integration feature */
37 typedef struct cpu_ti {
38   s_surf_resource_t generic_resource;   /*< Structure with generic data. Needed at begin to interate with SURF */
39   double power_peak;            /*< CPU power peak */
40   double power_scale;           /*< Percentage of CPU disponible */
41   surf_cpu_ti_tgmr_t avail_trace;       /*< Structure with data needed to integrate trace file */
42   e_surf_resource_state_t state_current;        /*< CPU current state (ON or OFF) */
43   tmgr_trace_event_t state_event;       /*< trace file with states events (ON or OFF) */
44   tmgr_trace_event_t power_event;       /*< trace file with availabitly events */
45   xbt_swag_t action_set;        /*< set with all actions running on cpu */
46   s_xbt_swag_hookup_t modified_cpu_hookup;      /*< hookup to swag that indicacates whether share resources must be recalculated or not */
47   double sum_priority;          /*< the sum of actions' priority that are running on cpu */
48   double last_update;           /*< last update of actions' remaining amount done */
49 } s_cpu_ti_t, *cpu_ti_t;
50
51 typedef struct surf_action_ti {
52   s_surf_action_t generic_action;
53   s_xbt_swag_hookup_t cpu_list_hookup;
54   void *cpu;
55   int suspended;
56   int index_heap;
57 } s_surf_action_cpu_ti_t, *surf_action_cpu_ti_t;
58
59 /* Epsilon */
60 #define EPSILON 0.000000001
61 /* Usefull define to get the cpu where action is running on */
62 #define ACTION_GET_CPU(action) ((cpu_ti_t)((surf_action_cpu_ti_t)action)->cpu)
63
64
65 #endif                          /* _SURF_CPU_TI_PRIVATE_H */