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"
17 #define NO_MAX_DURATION -1.0
18 #define SG_TCP_CTE_GAMMA 20000.0
20 extern const char *surf_action_state_names[6];
23 SURF_NETWORK_LINK_ON = 1, /* Ready */
24 SURF_NETWORK_LINK_OFF = 0 /* Running */
25 } e_surf_network_link_state_t;
28 SURF_NETWORK_LINK_SHARED = 1,
29 SURF_NETWORK_LINK_FATPIPE = 0
30 } e_surf_network_link_sharing_policy_t;
32 typedef struct surf_resource_private {
33 int (*resource_used) (void *resource_id);
34 /* Share the resources to the actions and return in hom much time
35 the next action may terminate */
36 double (*share_resources) (double now);
37 /* Update the actions' state */
38 void (*update_actions_state) (double now, double delta);
39 void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
41 void (*finalize) (void);
42 } s_surf_resource_private_t;
44 /* #define pub2priv(r) ((surf_resource_private_t) ((char *)(r) -(sizeof(struct surf_resource_private_part)))) */
45 /* #define priv2pub(r) ((void *) ((char *)(r) +(sizeof(struct surf_resource_private_part)))) */
47 extern int use_sdp_solver;
48 extern int use_lagrange_solver;
50 double generic_maxmin_share_resources(xbt_swag_t running_actions,
52 double generic_maxmin_share_resources2(xbt_swag_t running_actions,
55 void (*solve)(lmm_system_t));
57 /* Generic functions common to all ressources */
58 e_surf_action_state_t surf_action_get_state(surf_action_t action);
59 double surf_action_get_start_time(surf_action_t action);
60 double surf_action_get_finish_time(surf_action_t action);
61 void surf_action_free(surf_action_t * action);
62 void surf_action_change_state(surf_action_t action,
63 e_surf_action_state_t state);
64 void surf_action_set_data(surf_action_t action,
66 FILE * surf_fopen(const char *name, const char *mode);
68 extern lmm_system_t maxmin_system;
69 extern tmgr_history_t history;
70 extern xbt_dynar_t surf_path;
74 * Returns the initial path. On Windows the initial path is
75 * the current directory for the current process in the other
76 * case the function returns "./" that represents the current
77 * directory on Unix/Linux platforms.
79 const char* __surf_get_initial_path(void);
81 /* The __surf_is_absolute_file_path() returns 1 if
82 * file_path is a absolute file path, in the other
83 * case the function returns 0.
85 int __surf_is_absolute_file_path(const char* file_path);
87 #endif /* _SURF_SURF_PRIVATE_H */