X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f2e6b48eb3a7799a9670a54150ecdfc5139e2e21..a4794c528915dd8e12af401969783fdd552bf4a2:/examples/msg/tracing/user_variables.c diff --git a/examples/msg/tracing/user_variables.c b/examples/msg/tracing/user_variables.c index 938e690615..87a7fa00a1 100644 --- a/examples/msg/tracing/user_variables.c +++ b/examples/msg/tracing/user_variables.c @@ -4,6 +4,16 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +/** @addtogroup MSG_examples + * + * - tracing/user_variables.c: This program demonstrates how to + * trace user variables associated to the hosts of the platform file. + * You might want to run this program with the following parameters: + * --cfg=tracing:1 + * --cfg=tracing/platform:1 + * (See \ref tracing_tracing_options for details) + */ + #include #include "msg/msg.h" #include "xbt/sysdep.h" /* calloc, printf */ @@ -69,6 +79,27 @@ int main(int argc, char *argv[]) MSG_launch_application(deployment_file); MSG_main(); + + //get user declared variables + unsigned int cursor; + char *variable; + xbt_dynar_t host_variables = TRACE_get_host_variables (); + if (host_variables){ + XBT_INFO ("Declared host variables:"); + xbt_dynar_foreach (host_variables, cursor, variable){ + XBT_INFO ("%s", variable); + } + xbt_dynar_free (&host_variables); + } + xbt_dynar_t link_variables = TRACE_get_link_variables (); + if (link_variables){ + XBT_INFO ("Declared link variables:"); + xbt_dynar_foreach (link_variables, cursor, variable){ + XBT_INFO ("%s", variable); + } + xbt_dynar_free (&link_variables); + } + MSG_clean(); return 0; }