Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill the dangerous MSG_task_ref() now that the bindings don't use it anymore
[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 #include "surf/random_mgr.h"
17 #include "instr/private.h"
18
19 #define NO_MAX_DURATION -1.0
20
21 /* user-visible parameters */
22 extern double sg_tcp_gamma;
23 extern double sg_latency_factor;
24 extern double sg_bandwidth_factor;
25 extern double sg_weight_S_parameter;
26 extern int sg_maxmin_selective_update;
27 #ifdef HAVE_GTNETS
28   extern double sg_gtnets_jitter;
29   extern int sg_gtnets_jitter_seed;
30 #endif
31
32
33 extern const char *surf_action_state_names[6];
34
35 typedef enum {
36   SURF_LINK_SHARED = 1,
37   SURF_LINK_FATPIPE = 0
38 } e_surf_link_sharing_policy_t;
39
40 typedef struct surf_model_private {
41   int (*resource_used) (void *resource_id);
42   /* Share the resources to the actions and return in how much time
43      the next action may terminate */
44   double (*share_resources) (double now);
45   /* Update the actions' state */
46   void (*update_actions_state) (double now, double delta);
47   void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
48                                  double value, double time);
49   void (*finalize) (void);
50 } s_surf_model_private_t;
51
52 double generic_maxmin_share_resources(xbt_swag_t running_actions,
53                                       size_t offset,
54                                       lmm_system_t sys,
55                                       void (*solve) (lmm_system_t));
56
57 /* Generic functions common to all models */
58 e_surf_action_state_t surf_action_state_get(surf_action_t action); /* cannot declare inline since we use a pointer to it */
59 double surf_action_get_start_time(surf_action_t action); /* cannot declare inline since we use a pointer to it */
60 double surf_action_get_finish_time(surf_action_t action); /* cannot declare inline since we use a pointer to it */
61 void surf_action_free(surf_action_t * action);
62 void surf_action_state_set(surf_action_t action,
63                               e_surf_action_state_t state);
64 void surf_action_data_set(surf_action_t action, void *data); /* cannot declare inline since we use a pointer to it */
65 FILE *surf_fopen(const char *name, const char *mode);
66
67 extern tmgr_history_t history;
68 extern xbt_dynar_t surf_path;
69
70 void surf_config_init(int *argc, char **argv);
71 void surf_config_finalize(void);
72 void surf_config(const char *name, va_list pa);
73
74
75 /*
76  * Returns the initial path. On Windows the initial path is
77  * the current directory for the current process in the other
78  * case the function returns "./" that represents the current
79  * directory on Unix/Linux platforms.
80  */
81 const char *__surf_get_initial_path(void);
82
83 /* The __surf_is_absolute_file_path() returns 1 if
84  * file_path is a absolute file path, in the other
85  * case the function returns 0.
86  */
87 int __surf_is_absolute_file_path(const char *file_path);
88
89 /*
90  * One link routing list
91  */
92 typedef struct {
93         int src_id;
94         int dst_id;
95         void *link_ptr;
96 }s_onelink, *s_onelink_t;
97
98
99 /*
100  * Routing logic
101  */
102 struct s_routing {
103   const char *name;
104   xbt_dict_t host_id; /* char* -> int* */
105   xbt_dynar_t (*get_route)(int src, int dst);
106   xbt_dict_t (*get_onelink_routes)(void);
107   int (*is_router)(int id);
108   void (*finalize)(void);
109   int host_count;
110   int router_count;
111 };
112 XBT_PUBLIC(void) routing_model_create(size_t size_of_link,void *loopback);
113
114
115 /*
116  * Resource protected methods
117  */
118 XBT_PUBLIC(xbt_dict_t) surf_resource_properties(const void *resource);
119
120 XBT_PUBLIC(void) surfxml_bufferstack_push(int new);
121 XBT_PUBLIC(void) surfxml_bufferstack_pop(int new);
122 XBT_PUBLIC_DATA(int) surfxml_bufferstack_size;
123
124
125 #endif /* _SURF_SURF_PRIVATE_H */