4 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #ifndef _SURF_CPU_TI_PRIVATE_H
10 #define _SURF_CPU_TI_PRIVATE_H
13 typedef struct surf_cpu_ti_timeSeries {
14 long nb_points; /*< Number of points in the series */
15 double spacing; /*< Spacing between two points */
16 double *values; /*< Array of size nb_points */
17 tmgr_trace_t power_trace; /*< Copy of power trace structure */
18 int *trace_index; /*< Array of index. Each element is the index of first point in interval [spacing*i, spacing*(i+1)[ . Negative value indicates that there are no points in this spacing interval */
19 double *trace_value; /*< Array with the date when the event trace_index[i] happens. */
20 } s_surf_cpu_ti_timeSeries_t, *surf_cpu_ti_timeSeries_t;
23 typedef struct surf_cpu_ti_tgmr {
25 TRACE_FIXED, /*< Trace fixed, no availability file */
26 TRACE_DYNAMIC /*< Dynamic, availability file disponible */
29 double value; /*< Percentage of cpu power disponible. Value fixed between 0 and 1 */
32 double last_time; /*< Integral interval last point (discret time) */
33 double actual_last_time; /*< Actual size of integral interval */
34 double total; /*< Integral total between 0 and last_pointn */
36 surf_cpu_ti_timeSeries_t *levels; /*< Availability information */
37 int nb_levels; /*< Number of levels */
38 } s_surf_cpu_ti_tgmr_t, *surf_cpu_ti_tgmr_t;
41 /* CPU with trace integration feature */
42 typedef struct cpu_ti {
43 s_surf_resource_t generic_resource; /*< Structure with generic data. Needed at begin to interate with SURF */
44 double power_peak; /*< CPU power peak */
45 double power_scale; /*< Percentage of CPU disponible */
46 surf_cpu_ti_tgmr_t avail_trace; /*< Structure with data needed to integrate trace file */
47 e_surf_resource_state_t state_current; /*< CPU current state (ON or OFF) */
48 tmgr_trace_event_t state_event; /*< trace file with states events (ON or OFF) */
49 tmgr_trace_event_t power_event; /*< trace file with availabitly events */
50 xbt_swag_t action_set; /*< set with all actions running on cpu */
51 s_xbt_swag_hookup_t modified_cpu_hookup; /*< hookup to swag that indicacates whether share resources must be recalculated or not */
52 double sum_priority; /*< the sum of actions' priority that are running on cpu */
53 double last_update; /*< last update of actions' remaining amount done */
54 } s_cpu_ti_t, *cpu_ti_t;
56 typedef struct surf_action_ti {
57 s_surf_action_t generic_action;
58 s_xbt_swag_hookup_t cpu_list_hookup;
62 } s_surf_action_cpu_ti_t, *surf_action_cpu_ti_t;
64 /* Time-step for resource performance traces */
65 #define TRACE_TIMESTEP 10.00
66 /* Number of levels for resource performance traces */
67 #define TRACE_NB_LEVELS 4
69 #define EPSILON 0.000000001
70 /* Usefull define to get the cpu where action is running on */
71 #define ACTION_GET_CPU(action) ((cpu_ti_t)((surf_action_cpu_ti_t)action)->cpu)
74 #endif /* _SURF_CPU_TI_PRIVATE_H */