1 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef _SURF_SURF_PRIVATE_H
7 #define _SURF_SURF_PRIVATE_H
10 #include "surf/maxmin.h"
11 #include "surf/trace_mgr.h"
13 #include "surf/surfxml_parse_private.h"
14 #include "surf/random_mgr.h"
15 #include "instr/private.h"
17 #define NO_MAX_DURATION -1.0
19 /* user-visible parameters */
20 extern double sg_tcp_gamma;
21 extern double sg_latency_factor;
22 extern double sg_bandwidth_factor;
23 extern double sg_weight_S_parameter;
24 extern int sg_maxmin_selective_update;
25 extern int sg_network_fullduplex;
27 extern double sg_gtnets_jitter;
28 extern int sg_gtnets_jitter_seed;
32 extern const char *surf_action_state_names[6];
34 typedef struct surf_model_private {
35 int (*resource_used) (void *resource_id);
36 /* Share the resources to the actions and return in how much time
37 the next action may terminate */
38 double (*share_resources) (double now);
39 /* Update the actions' state */
40 void (*update_actions_state) (double now, double delta);
41 void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
42 double value, double time);
43 void (*finalize) (void);
44 } s_surf_model_private_t;
46 double generic_maxmin_share_resources(xbt_swag_t running_actions,
49 void (*solve) (lmm_system_t));
51 /* Generic functions common to all models */
52 e_surf_action_state_t surf_action_state_get(surf_action_t action); /* cannot declare inline since we use a pointer to it */
53 double surf_action_get_start_time(surf_action_t action); /* cannot declare inline since we use a pointer to it */
54 double surf_action_get_finish_time(surf_action_t action); /* cannot declare inline since we use a pointer to it */
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); /* cannot declare inline since we use a pointer to it */
59 FILE *surf_fopen(const char *name, const char *mode);
61 extern tmgr_history_t history;
62 extern xbt_dynar_t surf_path;
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);
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.
75 const char *__surf_get_initial_path(void);
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.
81 int __surf_is_absolute_file_path(const char *file_path);
84 * One link routing list
90 }s_onelink, *s_onelink_t;
98 xbt_dict_t host_id; /* char* -> int* */
99 xbt_dynar_t (*get_route)(int src, int dst);
100 xbt_dict_t (*get_onelink_routes)(void);
101 int (*is_router)(int id);
102 void (*finalize)(void);
106 XBT_PUBLIC(void) routing_model_create(size_t size_of_link,void *loopback);
109 * generic methods to create resources bypassing the parser
110 * FIXME : better if added to the routing model instead
112 XBT_PUBLIC(void) routing_add_route(char *source_id,char *destination_id,xbt_dynar_t links_id,int action);
113 XBT_PUBLIC(void) routing_add_host(char* host_id);
114 XBT_PUBLIC(void) routing_set_routes(void);
117 * Resource protected methods
119 xbt_dict_t surf_resource_properties(const void *resource);
121 XBT_PUBLIC(void) surfxml_bufferstack_push(int new);
122 XBT_PUBLIC(void) surfxml_bufferstack_pop(int new);
123 XBT_PUBLIC_DATA(int) surfxml_bufferstack_size;
126 #endif /* _SURF_SURF_PRIVATE_H */