Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1d6c56ffd93acd60950b51f546acd53110055205
[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/surfxml_parse_private.h"
16
17 #define NO_MAX_DURATION -1.0
18 #define SG_TCP_CTE_GAMMA 20000.0
19
20 typedef enum {
21   SURF_NETWORK_LINK_ON = 1,     /* Ready        */
22   SURF_NETWORK_LINK_OFF = 0     /* Running      */
23 } e_surf_network_link_state_t;
24
25 typedef enum {
26   SURF_NETWORK_LINK_SHARED = 1,
27   SURF_NETWORK_LINK_FATPIPE = 0
28 } e_surf_network_link_sharing_policy_t;
29
30 typedef struct surf_resource_private {
31   int (*resource_used) (void *resource_id);
32   /* Share the resources to the actions and return in hom much time
33      the next action may terminate */
34   double (*share_resources) (double now);
35   /* Update the actions' state */
36   void (*update_actions_state) (double now, double delta);
37   void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
38                                  double value);
39   void (*finalize) (void);
40 } s_surf_resource_private_t;
41
42 /* #define pub2priv(r) ((surf_resource_private_t) ((char *)(r) -(sizeof(struct surf_resource_private_part)))) */
43 /* #define priv2pub(r) ((void *) ((char *)(r) +(sizeof(struct surf_resource_private_part)))) */
44
45 double generic_maxmin_share_resources(xbt_swag_t running_actions,
46                                       size_t offset);
47 double generic_maxmin_share_resources2(xbt_swag_t running_actions,
48                                        size_t offset,
49                                        lmm_system_t sys);
50
51 /* Generic functions common to all ressources */
52 e_surf_action_state_t surf_action_get_state(surf_action_t action);
53 void surf_action_free(surf_action_t * action);
54 void surf_action_change_state(surf_action_t action,
55                               e_surf_action_state_t state);
56 void surf_action_set_data(surf_action_t action,
57                           void *data);
58 FILE *surf_fopen(const char *name, const char *mode);
59
60 static _XBT_INLINE void surf_double_update(double *variable, double value) 
61 {
62   *variable -= value;
63   if(*variable< 0.00001) *variable = 0.0;
64 }
65 extern lmm_system_t maxmin_system;
66 extern tmgr_history_t history;
67 extern xbt_dynar_t surf_path;
68
69 #endif                          /* _SURF_SURF_PRIVATE_H */