Logo AND Algorithmique Numérique Distribuée

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