Logo AND Algorithmique Numérique Distribuée

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