3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
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. */
8 #ifndef _SURF_SURF_PRIVATE_H
9 #define _SURF_SURF_PRIVATE_H
11 #include "surf/surf.h"
12 #include "surf/maxmin.h"
13 #include "surf/trace_mgr.h"
15 #include "surf/surfxml_parse_private.h"
16 #include "surf/random_mgr.h"
18 #define NO_MAX_DURATION -1.0
19 extern double sg_tcp_gamma;
20 extern int sg_maxmin_selective_update;
22 extern const char *surf_action_state_names[6];
27 } e_surf_link_sharing_policy_t;
29 typedef struct surf_model_private {
30 int (*resource_used) (void *resource_id);
31 /* Share the resources to the actions and return in how much time
32 the next action may terminate */
33 double (*share_resources) (double now);
34 /* Update the actions' state */
35 void (*update_actions_state) (double now, double delta);
36 void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
37 double value, double time);
38 void (*finalize) (void);
39 } s_surf_model_private_t;
41 double generic_maxmin_share_resources(xbt_swag_t running_actions,
44 void (*solve) (lmm_system_t));
46 /* Generic functions common to all models */
47 e_surf_action_state_t surf_action_state_get(surf_action_t action);
48 double surf_action_get_start_time(surf_action_t action);
49 double surf_action_get_finish_time(surf_action_t action);
50 void surf_action_free(surf_action_t * action);
51 void surf_action_state_set(surf_action_t action,
52 e_surf_action_state_t state);
53 void surf_action_data_set(surf_action_t action, void *data);
54 FILE *surf_fopen(const char *name, const char *mode);
56 extern tmgr_history_t history;
57 extern xbt_dynar_t surf_path;
59 void surf_config_init(int *argc, char **argv);
60 void surf_config_finalize(void);
61 void surf_config(const char *name, va_list pa);
65 * Returns the initial path. On Windows the initial path is
66 * the current directory for the current process in the other
67 * case the function returns "./" that represents the current
68 * directory on Unix/Linux platforms.
70 const char *__surf_get_initial_path(void);
72 /* The __surf_is_absolute_file_path() returns 1 if
73 * file_path is a absolute file path, in the other
74 * case the function returns 0.
76 int __surf_is_absolute_file_path(const char *file_path);
83 xbt_dict_t host_id; /* char* -> int* */
85 xbt_dynar_t (*get_route)(int src, int dst);
86 void (*finalize)(void);
90 XBT_PUBLIC(void) routing_model_create(size_t size_of_link,void *loopback);
94 * Resource protected methods
96 XBT_PUBLIC(xbt_dict_t) surf_resource_properties(const void *resource);
98 XBT_PUBLIC(void) surfxml_bufferstack_push(int new);
99 XBT_PUBLIC(void) surfxml_bufferstack_pop(int new);
100 XBT_PUBLIC_DATA(int) surfxml_bufferstack_size;
103 #endif /* _SURF_SURF_PRIVATE_H */