Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use doxygen's section instead of my poor approximation; link to the list of all exist...
[simgrid.git] / src / surf / surf_private.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2004 Arnaud Legrand. 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_SURF_PRIVATE_H
9 #define _SURF_SURF_PRIVATE_H
10
11 #include "surf/surf.h"
12 #include "surf/maxmin.h"
13 #include "surf/trace_mgr.h"
14 #include "xbt/log.h"
15 #include "surf/surf_parse.h"
16
17 #define NO_MAX_DURATION -1.0
18
19 typedef enum {
20   SURF_NETWORK_LINK_ON = 1,     /* Ready        */
21   SURF_NETWORK_LINK_OFF = 0     /* Running      */
22 } e_surf_network_link_state_t;
23
24 typedef struct surf_resource_private {
25   int (*resource_used) (void *resource_id);
26   /* Share the resources to the actions and return in hom much time
27      the next action may terminate */
28   double (*share_resources) (double now);
29   /* Update the actions' state */
30   void (*update_actions_state) (double now, double delta);
31   void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
32                                  double value);
33   void (*finalize) (void);
34 } s_surf_resource_private_t;
35
36 /* #define pub2priv(r) ((surf_resource_private_t) ((char *)(r) -(sizeof(struct surf_resource_private_part)))) */
37 /* #define priv2pub(r) ((void *) ((char *)(r) +(sizeof(struct surf_resource_private_part)))) */
38
39 double generic_maxmin_share_resources(xbt_swag_t running_actions,
40                                       size_t offset);
41 double generic_maxmin_share_resources2(xbt_swag_t running_actions,
42                                        size_t offset,
43                                        lmm_system_t sys);
44
45 /* Generic functions common to all ressources */
46 e_surf_action_state_t surf_action_get_state(surf_action_t action);
47 void surf_action_free(surf_action_t * action);
48 void surf_action_change_state(surf_action_t action,
49                               e_surf_action_state_t state);
50 void surf_action_set_data(surf_action_t action,
51                           void *data);
52 FILE *surf_fopen(const char *name, const char *mode);
53
54 static _XBT_INLINE void surf_double_update(double *variable, double value) 
55 {
56   *variable -= value;
57   if(*variable< 0.00001) *variable = 0.0;
58 }
59 extern lmm_system_t maxmin_system;
60 extern tmgr_history_t history;
61 extern xbt_dynar_t surf_path;
62
63 #endif                          /* _SURF_SURF_PRIVATE_H */