Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
8c70cd3f758cbd34c905f0e65da34f826d68e1b5
[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
18 #define NO_MAX_DURATION -1.0
19 extern double sg_tcp_gamma;
20
21 extern const char *surf_action_state_names[6];
22
23 typedef enum {
24   SURF_LINK_SHARED = 1,
25   SURF_LINK_FATPIPE = 0
26 } e_surf_link_sharing_policy_t;
27
28 typedef struct surf_model_private {
29   int (*resource_used) (void *resource_id);
30   /* Share the resources to the actions and return in how much time
31      the next action may terminate */
32   double (*share_resources) (double now);
33   /* Update the actions' state */
34   void (*update_actions_state) (double now, double delta);
35   void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
36                                  double value, double time);
37   void (*finalize) (void);
38 } s_surf_model_private_t;
39
40 /* #define pub2priv(r) ((surf_model_private_t) ((char *)(r) -(sizeof(struct surf_model_private_part)))) */
41 /* #define priv2pub(r) ((void *) ((char *)(r) +(sizeof(struct surf_model_private_part)))) */
42
43 extern int use_sdp_solver;
44 extern int use_lagrange_solver;
45
46 double generic_maxmin_share_resources(xbt_swag_t running_actions,
47                                       size_t offset,
48                                       lmm_system_t sys,
49                                       void (*solve) (lmm_system_t));
50
51 /* Generic functions common to all models */
52 e_surf_action_state_t surf_action_state_get(surf_action_t action);
53 double surf_action_get_start_time(surf_action_t action);
54 double surf_action_get_finish_time(surf_action_t action);
55 void surf_action_free(surf_action_t * action);
56 void surf_action_state_set(surf_action_t action,
57                               e_surf_action_state_t state);
58 void surf_action_data_set(surf_action_t action, void *data);
59 FILE *surf_fopen(const char *name, const char *mode);
60
61 extern tmgr_history_t history;
62 extern xbt_dynar_t surf_path;
63
64 void surf_config_init(int *argc, char **argv);
65 void surf_config_finalize(void);
66 void surf_config(const char *name, va_list pa);
67
68
69 /*
70  * Returns the initial path. On Windows the initial path is
71  * the current directory for the current process in the other
72  * case the function returns "./" that represents the current
73  * directory on Unix/Linux platforms.
74  */
75 const char *__surf_get_initial_path(void);
76
77 /* The __surf_is_absolute_file_path() returns 1 if
78  * file_path is a absolute file path, in the other
79  * case the function returns 0.
80  */
81 int __surf_is_absolute_file_path(const char *file_path);
82
83 /*
84  * Routing logic
85  */
86 struct s_routing {
87   const char *name;
88   xbt_dict_t host_id; /* char* -> int* */
89
90   xbt_dynar_t (*get_route)(int src, int dst);
91   void (*finalize)(void);
92   int host_count;
93 };
94 XBT_PUBLIC(void) routing_model_create(size_t size_of_link,void *loopback);
95
96
97 /*
98  * Resource protected methods
99  */
100 XBT_PUBLIC(xbt_dict_t) surf_resource_properties(const void *resource);
101
102 #endif /* _SURF_SURF_PRIVATE_H */