A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
using two dictionaries to keep host information (name and id)
[simgrid.git]
/
src
/
instr
/
surf_instr.c
diff --git
a/src/instr/surf_instr.c
b/src/instr/surf_instr.c
index
afb8a18
..
61b703d
100644
(file)
--- a/
src/instr/surf_instr.c
+++ b/
src/instr/surf_instr.c
@@
-12,7
+12,9
@@
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(tracing_surf,tracing,"Tracing Surf");
#define VARIABLE_SEPARATOR '#'
#define VARIABLE_SEPARATOR '#'
-static xbt_dict_t hosts_id;
+static xbt_dict_t host_router_id; //name(char*) -> id(char*)
+static xbt_dict_t host_router_name; //id(char*) -> name (char*)
+
static xbt_dict_t created_links;
static xbt_dict_t link_bandwidth; //name(char*) -> bandwidth(double)
static xbt_dict_t link_latency; //name(char*) -> latency(double)
static xbt_dict_t created_links;
static xbt_dict_t link_bandwidth; //name(char*) -> bandwidth(double)
static xbt_dict_t link_latency; //name(char*) -> latency(double)
@@
-31,7
+33,8
@@
static xbt_dict_t gtnets_dst; /* %p (action) -> %s */
void __TRACE_surf_init (void)
{
void __TRACE_surf_init (void)
{
- hosts_id = xbt_dict_new();
+ host_router_id = xbt_dict_new();
+ host_router_name = xbt_dict_new();
created_links = xbt_dict_new();
link_bandwidth = xbt_dict_new();
link_latency = xbt_dict_new();
created_links = xbt_dict_new();
link_bandwidth = xbt_dict_new();
link_latency = xbt_dict_new();
@@
-336,7
+339,7
@@
void TRACE_surf_host_declaration (char *name, double power)
* TRACE_surf_link_save_endpoints (link_name, src, dst): this function
* creates the container of a link identified by link_name. It gets
* bandwidth and latency information from the dictionaries previously
* TRACE_surf_link_save_endpoints (link_name, src, dst): this function
* creates the container of a link identified by link_name. It gets
* bandwidth and latency information from the dictionaries previously
- * filled. The end points are obtained from the host
s_id
dictionary.
+ * filled. The end points are obtained from the host
_router_name
dictionary.
*
* caller: end of parsing
* main: create LINK containers, set initial bandwidth and latency values
*
* caller: end of parsing
* main: create LINK containers, set initial bandwidth and latency values
@@
-350,8
+353,8
@@
void TRACE_surf_link_save_endpoints (char *link_name, int src, int dst)
if (!IS_TRACING) return;
snprintf (srcidstr, 100, "%d", src);
snprintf (dstidstr, 100, "%d", dst);
if (!IS_TRACING) return;
snprintf (srcidstr, 100, "%d", src);
snprintf (dstidstr, 100, "%d", dst);
- char *srcname = xbt_dict_get (host
s_id
, srcidstr);
- char *dstname = xbt_dict_get (host
s_id
, dstidstr);
+ char *srcname = xbt_dict_get (host
_router_name
, srcidstr);
+ char *dstname = xbt_dict_get (host
_router_name
, dstidstr);
snprintf (key, 100, "l%d-%d", src, dst);
if (strcmp (link_name, "__loopback__")==0 ||
snprintf (key, 100, "l%d-%d", src, dst);
if (strcmp (link_name, "__loopback__")==0 ||
@@
-380,11
+383,11
@@
void TRACE_surf_link_save_endpoints (char *link_name, int src, int dst)
*/
void TRACE_surf_host_define_id (const char *name, int host_id)
{
*/
void TRACE_surf_host_define_id (const char *name, int host_id)
{
- char strid[100];
if (!IS_TRACING) return;
if (!IS_TRACING) return;
+ char strid[100];
snprintf (strid, 100, "%d", host_id);
snprintf (strid, 100, "%d", host_id);
- xbt_dict_set (host
s_id, name, strdup(strid),
free);
- xbt_dict_set (host
s_id, strid, strdup(name),
free);
+ xbt_dict_set (host
_router_id, name, xbt_strdup(strid), xbt_
free);
+ xbt_dict_set (host
_router_name, strid, xbt_strdup(name), xbt_
free);
}
void TRACE_surf_host_set_power (double date, char *resource, double power)
}
void TRACE_surf_host_set_power (double date, char *resource, double power)