Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move module tracing into corresponding modules
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 20 Dec 2012 13:29:48 +0000 (14:29 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 20 Dec 2012 13:45:26 +0000 (14:45 +0100)
21 files changed:
buildtools/Cmake/DefinePackages.cmake
examples/msg/actions/actions.c
include/xbt/graph.h
src/include/instr/instr_interface.h
src/include/smpi/smpi_interface.h [new file with mode: 0644]
src/include/surf/surf.h
src/instr/instr_config.c
src/instr/instr_paje_containers.c
src/instr/instr_private.h
src/msg/instr_msg_process.c [moved from src/instr/instr_msg_process.c with 98% similarity]
src/msg/instr_msg_task.c [moved from src/instr/instr_msg_task.c with 99% similarity]
src/msg/msg_global.c
src/msg/msg_private.h
src/simdag/sd_global.c
src/simgrid/sg_config.c
src/smpi/instr_smpi.c [moved from src/instr/instr_smpi.c with 99% similarity]
src/smpi/private.h
src/surf/instr_routing.c [moved from src/instr/instr_routing.c with 100% similarity]
src/surf/instr_surf.c [moved from src/instr/instr_surf.c with 100% similarity]
src/surf/surf_private.h
src/xbt/graph_private.h

index 32264f5..cf19942 100644 (file)
@@ -93,6 +93,7 @@ set(EXTRA_DIST
   )
 
 set(SMPI_SRC
+  src/smpi/instr_smpi.c
   src/smpi/smpi_base.c
   src/smpi/smpi_bench.c
   src/smpi/smpi_c99.c
@@ -186,6 +187,8 @@ set(SURF_SRC
   src/surf/cpu_cas01.c
   src/surf/cpu_ti.c
   src/surf/fair_bottleneck.c
+  src/surf/instr_routing.c
+  src/surf/instr_surf.c
   src/surf/lagrange.c
   src/surf/maxmin.c
   src/surf/network.c
@@ -235,6 +238,8 @@ set(SIMGRID_SRC
   )
 
 set(MSG_SRC
+  src/msg/instr_msg_process.c
+  src/msg/instr_msg_task.c
   src/msg/msg_actions.c
   src/msg/msg_config.c
   src/msg/msg_deployment.c
@@ -318,8 +323,6 @@ set(LUA_SRC
 set(TRACING_SRC
   src/instr/instr_config.c
   src/instr/instr_interface.c
-  src/instr/instr_msg_process.c
-  src/instr/instr_msg_task.c
   src/instr/instr_paje_containers.c
   src/instr/instr_paje_trace.c
   src/instr/instr_paje_header.c
@@ -327,9 +330,6 @@ set(TRACING_SRC
   src/instr/instr_paje_values.c
   src/instr/instr_private.h
   src/instr/instr_resource_utilization.c
-  src/instr/instr_routing.c
-  src/instr/instr_smpi.c
-  src/instr/instr_surf.c
   )
 
 set(JEDULE_SRC
@@ -466,6 +466,8 @@ set(simgrid_sources
   ${SIMGRID_SRC}
   ${SIMIX_SRC}
   ${SURF_SRC}
+  ${SMPI_SRC}
+  ${TRACING_SRC}
   ${XBT_SRC}
   )
 
index 746afe2..a591bd3 100644 (file)
@@ -100,13 +100,6 @@ static void action_send(const char *const *action)
   if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
     name = xbt_str_join_array(action, " ");
 
-#ifdef HAVE_TRACING
-  int rank = get_rank(MSG_process_get_name(MSG_process_self()));
-  int dst_traced = get_rank(action[2]);
-  TRACE_smpi_ptp_in(rank, rank, dst_traced, "send");
-  TRACE_smpi_send(rank, rank, dst_traced);
-#endif
-
   XBT_DEBUG("Entering Send: %s (size: %lg)", name, size);
    if (size<65536) {
      action_Isend(action);
@@ -117,11 +110,6 @@ static void action_send(const char *const *action)
    XBT_VERB("%s %f", name, MSG_get_clock() - clock);
 
   free(name);
-
-#ifdef HAVE_TRACING
-  TRACE_smpi_ptp_out(rank, rank, dst_traced, "send");
-#endif
-
   asynchronous_cleanup();
 }
 
@@ -158,12 +146,6 @@ static void action_recv(const char *const *action)
   if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
     name = xbt_str_join_array(action, " ");
 
-#ifdef HAVE_TRACING
-  int rank = get_rank(MSG_process_get_name(MSG_process_self()));
-  int src_traced = get_rank(action[2]);
-  TRACE_smpi_ptp_in(rank, src_traced, rank, "recv");
-#endif
-
   XBT_DEBUG("Receiving: %s", name);
   msg_error_t res = MSG_task_receive(&task, mailbox_name);
   //  MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
@@ -174,11 +156,6 @@ static void action_recv(const char *const *action)
   }
 
   free(name);
-#ifdef HAVE_TRACING
-  TRACE_smpi_ptp_out(rank, src_traced, rank, "recv");
-  TRACE_smpi_recv(rank, src_traced, rank);
-#endif
-
   asynchronous_cleanup();
 }
 
@@ -189,14 +166,6 @@ static void action_Irecv(const char *const *action)
   process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
 
   XBT_DEBUG("Irecv on %s", MSG_process_get_name(MSG_process_self()));
-#ifdef HAVE_TRACING
-  int rank = get_rank(MSG_process_get_name(MSG_process_self()));
-  int src_traced = get_rank(action[2]);
-  globals->last_Irecv_sender_id = src_traced;
-  MSG_process_set_data(MSG_process_self(), (void *) globals);
-
-  TRACE_smpi_ptp_in(rank, src_traced, rank, "Irecv");
-#endif
 
   sprintf(mailbox, "%s_%s", action[2],
           MSG_process_get_name(MSG_process_self()));
@@ -210,10 +179,6 @@ static void action_Irecv(const char *const *action)
 
   XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
 
-#ifdef HAVE_TRACING
-  TRACE_smpi_ptp_out(rank, src_traced, rank, "Irecv");
-#endif
-
   asynchronous_cleanup();
 }
 
@@ -231,12 +196,6 @@ static void action_wait(const char *const *action)
 
   if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
     name = xbt_str_join_array(action, " ");
-#ifdef HAVE_TRACING
-  process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self());
-  int src_traced = counters->last_Irecv_sender_id;
-  int rank = get_rank(MSG_process_get_name(MSG_process_self()));
-  TRACE_smpi_ptp_in(rank, src_traced, rank, "wait");
-#endif
 
   XBT_DEBUG("Entering %s", name);
   comm = xbt_dynar_pop_as(globals->irecvs,msg_comm_t);
@@ -247,11 +206,6 @@ static void action_wait(const char *const *action)
 
   XBT_VERB("%s %f", name, MSG_get_clock() - clock);
   free(name);
-#ifdef HAVE_TRACING
-  TRACE_smpi_ptp_out(rank, src_traced, rank, "wait");
-  TRACE_smpi_recv(rank, src_traced, rank);
-#endif
-
 }
 
 /* FIXME: that's a poor man's implementation: we should take the message exchanges into account */
@@ -521,9 +475,6 @@ static void action_compute(const char *const *action)
 
 static void action_init(const char *const *action)
 { 
-#ifdef HAVE_TRACING
-  TRACE_smpi_init(get_rank(MSG_process_get_name(MSG_process_self())));
-#endif
   XBT_DEBUG("Initialize the counters");
   process_globals_t globals = (process_globals_t) calloc(1, sizeof(s_process_globals_t));
   globals->isends = xbt_dynar_new(sizeof(msg_comm_t),NULL);
@@ -535,9 +486,6 @@ static void action_init(const char *const *action)
 
 static void action_finalize(const char *const *action)
 {
-#ifdef HAVE_TRACING
-  TRACE_smpi_finalize(get_rank(MSG_process_get_name(MSG_process_self())));
-#endif
   process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
   if (globals){
     xbt_dynar_free_container(&(globals->isends));
index 64e0648..38a3512 100644 (file)
@@ -15,10 +15,48 @@ SG_BEGIN_DECL()
    *
    * @{
    */
+
 typedef struct xbt_node *xbt_node_t;
 typedef struct xbt_edge *xbt_edge_t;
 typedef struct xbt_graph *xbt_graph_t;
 
+/* Node structure */
+/* Be carfull of what you do with this structure */
+/* typedef struct xbt_node *xbt_node_t; */
+typedef struct xbt_node {
+  xbt_dynar_t out;
+  xbt_dynar_t in;               /* not used when the graph is directed */
+  double position_x;            /* positive value: negative means undefined */
+  double position_y;            /* positive value: negative means undefined */
+  void *data;                   /* user data */
+  void *xbtdata;                /* private xbt data: should be reinitialized at the
+                                   beginning of your algorithm if you need to use it */
+} s_xbt_node_t;
+
+/* edge structure */
+/* Be carfull of what you do with this structure */
+/* typedef struct xbt_edge *xbt_edge_t; */
+typedef struct xbt_edge {
+  xbt_node_t src;
+  xbt_node_t dst;
+  void *data;                   /* user data */
+  void *xbtdata;                /* private xbt data: should be reinitialized at the
+                                   beginning of your algorithm if you need to use it */
+  double length;                /* positive value: negative means undefined */
+} s_xbt_edge_t;
+
+/* Graph structure */
+/* Be carfull of what you do with this structure */  
+/* typedef struct xbt_graph *xbt_graph_t; */
+typedef struct xbt_graph {
+  xbt_dynar_t nodes;
+  xbt_dynar_t edges;
+  unsigned short int directed;
+  void *data;                   /* user data */
+  void *xbtdata;                /* private xbt data: should be reinitialized at the
+                                   beginning of your algorithm if you need to use it */
+} s_xbt_graph_t;
+
 /* API */
 XBT_PUBLIC(xbt_graph_t) xbt_graph_new_graph(unsigned short int directed,
                                             void *data);
index de9ba70..2ae6f3c 100644 (file)
@@ -1 +1,8 @@
+int TRACE_start (void);
+int TRACE_end (void);
+void TRACE_global_init(int *argc, char **argv);
 void TRACE_help(int detailed);
+void TRACE_surf_resource_utilization_alloc(void);
+void TRACE_surf_resource_utilization_release(void);
+void TRACE_add_start_function(void (*func)(void));
+void TRACE_add_end_function(void (*func)(void));
diff --git a/src/include/smpi/smpi_interface.h b/src/include/smpi/smpi_interface.h
new file mode 100644 (file)
index 0000000..1b24074
--- /dev/null
@@ -0,0 +1,12 @@
+#include "smpi/smpi.h"
+
+/********** Tracing **********/
+/* from smpi_instr.c */
+void TRACE_smpi_alloc(void);
+void TRACE_smpi_release(void);
+void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
+void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
+void TRACE_smpi_send(int rank, int src, int dst);
+void TRACE_smpi_recv(int rank, int src, int dst);
+void TRACE_smpi_init(int rank);
+void TRACE_smpi_finalize(int rank);
index 6100dfa..5bb8d19 100644 (file)
@@ -10,6 +10,7 @@
 #include "xbt/swag.h"
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
+#include "xbt/graph.h"
 #include "xbt/misc.h"
 #include "xbt/file_stat.h"
 #include "portable.h"
@@ -740,5 +741,21 @@ void surf_watched_hosts(void);
  */
 const char *__surf_get_initial_path(void);
 
+/********** Tracing **********/
+/* from surf_instr.c */
+void TRACE_surf_action(surf_action_t surf_action, const char *category);
+void TRACE_surf_alloc(void);
+void TRACE_surf_release(void);
+
+/* instr_routing.c */
+void instr_routing_define_callbacks (void);
+void instr_new_variable_type (const char *new_typename, const char *color);
+void instr_new_user_variable_type  (const char *father_type, const char *new_typename, const char *color);
+void instr_new_user_state_type (const char *father_type, const char *new_typename);
+void instr_new_value_for_user_state_type (const char *typename, const char *value, const char *color);
+int instr_platform_traced (void);
+xbt_graph_t instr_routing_platform_graph (void);
+void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
+
 SG_END_DECL()
 #endif                          /* _SURF_SURF_H */
index 9da8976..7dcb4ab 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "instr/instr_private.h"
 #include "simgrid/sg_config.h"
+#include "surf/surf.h"
 
 #ifdef HAVE_TRACING
 
@@ -48,6 +49,8 @@ static int trace_basic;
 static int trace_configured = 0;
 static int trace_active = 0;
 
+
+
 static void TRACE_getopts(void)
 {
   trace_enabled = xbt_cfg_get_int(_sg_cfg_set, OPT_TRACING);
@@ -65,6 +68,13 @@ static void TRACE_getopts(void)
   trace_basic = xbt_cfg_get_int(_sg_cfg_set, OPT_TRACING_BASIC);
 }
 
+xbt_dynar_t TRACE_start_functions = NULL;
+void TRACE_add_start_function(void (*func)()) {
+  if (TRACE_start_functions==NULL)
+    TRACE_start_functions = xbt_dynar_new(sizeof(void (*)()), NULL);   
+  xbt_dynar_push(TRACE_start_functions, &func);    
+}
+
 int TRACE_start()
 {
   TRACE_getopts();
@@ -93,11 +103,24 @@ int TRACE_start()
   declared_marks = xbt_dict_new_homogeneous (xbt_free);
   user_host_variables = xbt_dict_new_homogeneous (xbt_free);
   user_link_variables = xbt_dict_new_homogeneous (xbt_free);
-  TRACE_surf_alloc();
-  TRACE_smpi_alloc();
+
+  if (TRACE_start_functions!=NULL) {
+    void (*func)();
+    unsigned int iter = xbt_dynar_length(TRACE_start_functions);
+    xbt_dynar_foreach(TRACE_start_functions, iter, func) {
+      func();
+    }
+  }
   return 0;
 }
 
+xbt_dynar_t TRACE_end_functions = NULL;
+void TRACE_add_end_function(void (*func)(void)) {
+  if (TRACE_end_functions==NULL)
+    TRACE_end_functions = xbt_dynar_new(sizeof(void (*) (void)), NULL);   
+  xbt_dynar_push(TRACE_end_functions, &func);    
+}
+
 int TRACE_end()
 {
   if (!trace_active)
@@ -115,8 +138,15 @@ int TRACE_end()
   PJ_type_free_all();
   PJ_container_release();
   PJ_type_release();
-  TRACE_smpi_release();
-  TRACE_surf_release();
+
+  if (TRACE_end_functions!=NULL) {
+    void (*func) (void);
+    unsigned int iter;
+    xbt_dynar_foreach(TRACE_end_functions, iter, func) {
+      func();
+    }
+  }
+
   xbt_dict_free(&user_link_variables);
   xbt_dict_free(&user_host_variables);
   xbt_dict_free(&declared_marks);
index 64e0608..64590e9 100644 (file)
@@ -5,6 +5,9 @@
   * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "instr/instr_private.h"
+#include "xbt/lib.h"
+#include "surf/surf.h"
+#include "surf/surf_routing.h"
 
 #ifdef HAVE_TRACING
 
index 98cbb15..9729978 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef INSTR_PRIVATE_H_
 #define INSTR_PRIVATE_H_
 
+#include "instr/instr.h"
 #include "instr/instr_interface.h"
 #include "simgrid_config.h"
 
 
 #define INSTR_DEFAULT_STR_SIZE 500
 
-#include "msg/msg.h"
-#include "simdag/private.h"
-#include "simix/smx_private.h"
-#include "xbt/graph_private.h"
+#include "xbt/graph.h"
+#include "xbt/dict.h"
+#include "simgrid/platf.h"
 
 typedef enum {
   PAJE_DefineContainerType,
@@ -126,62 +126,10 @@ void new_pajeStartLink (double timestamp, container_t container, type_t type, co
 void new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
 void new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
 
-/* declaration of instrumentation functions from msg_task_instr.c */
-void TRACE_msg_set_task_category(msg_task_t task, const char *category);
-void TRACE_msg_task_create(msg_task_t task);
-void TRACE_msg_task_execute_start(msg_task_t task);
-void TRACE_msg_task_execute_end(msg_task_t task);
-void TRACE_msg_task_destroy(msg_task_t task);
-void TRACE_msg_task_get_start(void);
-void TRACE_msg_task_get_end(double start_time, msg_task_t task);
-int TRACE_msg_task_put_start(msg_task_t task);    //returns TRUE if the task_put_end must be called
-void TRACE_msg_task_put_end(void);
-
-/* declaration of instrumentation functions from msg_process_instr.c */
-char *instr_process_id (msg_process_t proc, char *str, int len);
-char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len);
-void TRACE_msg_process_change_host(msg_process_t process, msg_host_t old_host,
-                                   msg_host_t new_host);
-void TRACE_msg_process_create (const char *process_name, int process_pid, msg_host_t host);
-void TRACE_msg_process_destroy (const char *process_name, int process_pid, msg_host_t host);
-void TRACE_msg_process_kill(msg_process_t process);
-void TRACE_msg_process_suspend(msg_process_t process);
-void TRACE_msg_process_resume(msg_process_t process);
-void TRACE_msg_process_sleep_in(msg_process_t process);   //called from msg/gos.c
-void TRACE_msg_process_sleep_out(msg_process_t process);
-void TRACE_msg_process_end(msg_process_t process);
-
-/* from surf_instr.c */
-void TRACE_surf_alloc(void);
-void TRACE_surf_release(void);
-void TRACE_surf_host_set_power(double date, const char *resource, double power);
-void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
-void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
-void TRACE_surf_action(surf_action_t surf_action, const char *category);
-
 //for tracing gtnets
 void TRACE_surf_gtnets_communicate(void *action, void *src, void *dst);
 
-/* from smpi_instr.c */
-void TRACE_internal_smpi_set_category (const char *category);
-const char *TRACE_internal_smpi_get_category (void);
-void TRACE_smpi_alloc(void);
-void TRACE_smpi_release(void);
-void TRACE_smpi_init(int rank);
-void TRACE_smpi_finalize(int rank);
-void TRACE_smpi_collective_in(int rank, int root, const char *operation);
-void TRACE_smpi_collective_out(int rank, int root, const char *operation);
-void TRACE_smpi_computing_init(int rank);
-void TRACE_smpi_computing_out(int rank);
-void TRACE_smpi_computing_in(int rank);
-void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
-void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
-void TRACE_smpi_send(int rank, int src, int dst);
-void TRACE_smpi_recv(int rank, int src, int dst);
-
 /* from instr_config.c */
-int TRACE_start (void);
-int TRACE_end (void);
 int TRACE_needs_platform (void);
 int TRACE_is_enabled(void);
 int TRACE_platform(void);
@@ -202,7 +150,6 @@ char *TRACE_get_comment_file (void);
 char *TRACE_get_filename(void);
 char *TRACE_get_viva_uncat_conf (void);
 char *TRACE_get_viva_cat_conf (void);
-void TRACE_global_init(int *argc, char **argv);
 void TRACE_generate_viva_uncat_conf (void);
 void TRACE_generate_viva_cat_conf (void);
 void instr_pause_tracing (void);
@@ -220,7 +167,6 @@ void TRACE_surf_link_set_utilization(const char *resource,
                                      double now,
                                      double delta);
 void TRACE_surf_resource_utilization_alloc(void);
-void TRACE_surf_resource_utilization_release(void);
 
 /* instr_paje.c */
 extern xbt_dict_t trivaNodeTypes;
@@ -257,16 +203,6 @@ val_t PJ_value_get_or_new (const char *name, const char *color, type_t father);
 val_t PJ_value_get (const char *name, const type_t father);
 void PJ_value_free (val_t value);
 
-/* instr_routing.c */
-void instr_routing_define_callbacks (void);
-void instr_new_variable_type (const char *new_typename, const char *color);
-void instr_new_user_variable_type  (const char *father_type, const char *new_typename, const char *color);
-void instr_new_user_state_type (const char *father_type, const char *new_typename);
-void instr_new_value_for_user_state_type (const char *typename, const char *value, const char *color);
-int instr_platform_traced (void);
-xbt_graph_t instr_routing_platform_graph (void);
-void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
-
 #endif /* HAVE_TRACING */
 
 #ifdef HAVE_JEDULE
similarity index 98%
rename from src/instr/instr_msg_process.c
rename to src/msg/instr_msg_process.c
index 29d321b..dba5b6b 100644 (file)
@@ -4,9 +4,12 @@
 /* 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. */
 
-#include "instr/instr_private.h"
+#include "msg_private.h"
 #include "mc/mc.h"
 
+#include "msg/datatypes.h"
+#include "simix/smx_process_private.h"
+
 #ifdef HAVE_TRACING
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process");
similarity index 99%
rename from src/instr/instr_msg_task.c
rename to src/msg/instr_msg_task.c
index 39da9d7..52acde4 100644 (file)
@@ -5,8 +5,11 @@
   * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "instr/instr_private.h"
+#include "msg_private.h"
+#include "msg/datatypes.h"
 #include "mc/mc.h"
 
+
 #ifdef HAVE_TRACING
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg, instr, "MSG");
index 81abae0..b7cfb42 100644 (file)
@@ -4,6 +4,7 @@
 /* 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. */
 
+#include "instr/instr_interface.h"
 #include "msg_private.h"
 #include "msg_mailbox.h"
 #include "mc/mc.h"
@@ -152,7 +153,7 @@ static void MSG_exit(void) {
     return;
 
 #ifdef HAVE_TRACING
-  TRACE_surf_release();
+  TRACE_surf_resource_utilization_release();
 #endif
 
   /* initialization of the action module */
index 3c6c04d..6899c15 100644 (file)
@@ -154,5 +154,31 @@ void _MSG_action_exit(void);
 
 void MSG_post_create_environment(void);
 
+/********** Tracing **********/
+/* declaration of instrumentation functions from msg_task_instr.c */
+void TRACE_msg_set_task_category(msg_task_t task, const char *category);
+void TRACE_msg_task_create(msg_task_t task);
+void TRACE_msg_task_execute_start(msg_task_t task);
+void TRACE_msg_task_execute_end(msg_task_t task);
+void TRACE_msg_task_destroy(msg_task_t task);
+void TRACE_msg_task_get_start(void);
+void TRACE_msg_task_get_end(double start_time, msg_task_t task);
+int TRACE_msg_task_put_start(msg_task_t task);    //returns TRUE if the task_put_end must be called
+void TRACE_msg_task_put_end(void);
+
+/* declaration of instrumentation functions from msg_process_instr.c */
+char *instr_process_id (msg_process_t proc, char *str, int len);
+char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len);
+void TRACE_msg_process_change_host(msg_process_t process, msg_host_t old_host,
+                                   msg_host_t new_host);
+void TRACE_msg_process_create (const char *process_name, int process_pid, msg_host_t host);
+void TRACE_msg_process_destroy (const char *process_name, int process_pid, msg_host_t host);
+void TRACE_msg_process_kill(msg_process_t process);
+void TRACE_msg_process_suspend(msg_process_t process);
+void TRACE_msg_process_resume(msg_process_t process);
+void TRACE_msg_process_sleep_in(msg_process_t process);   //called from msg/gos.c
+void TRACE_msg_process_sleep_out(msg_process_t process);
+void TRACE_msg_process_end(msg_process_t process);
+
 SG_END_DECL()
 #endif
index d979db3..2931aa4 100644 (file)
@@ -5,6 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "private.h"
+#include "instr/instr_interface.h"
 #include "xbt/sysdep.h"
 #include "xbt/dynar.h"
 #include "surf/surf.h"
@@ -13,7 +14,6 @@
 #include "xbt/log.h"
 #include "xbt/str.h"
 #include "xbt/config.h"
-#include "instr/instr_private.h"
 #include "surf/surfxml_parse.h"
 #ifdef HAVE_LUA
 #include <lua.h>
@@ -382,7 +382,7 @@ double SD_get_clock(void) {
 void SD_exit(void)
 {
 #ifdef HAVE_TRACING
-  TRACE_surf_release();
+  TRACE_surf_resource_utilization_release();
 #endif
 
   xbt_mallocator_free(sd_global->task_mallocator);
index e647b9d..5810802 100644 (file)
@@ -18,7 +18,9 @@
 #include "instr/instr_interface.h"
 #include "simgrid/simix.h"
 #include "simgrid/sg_config.h"
-#include "mc/mc.h" 
+#include "smpi/smpi_interface.h"
+#include "mc/mc.h"
+#include "instr/instr.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf,
                                 "About the configuration of simgrid");
@@ -97,7 +99,6 @@ static void sg_config_cmd_line(int *argc, char **argv)
   }
 }
 
-
 /* callback of the workstation/model variable */
 static void _sg_cfg_cb__workstation_model(const char *name, int pos)
 {
@@ -344,6 +345,12 @@ void sg_config_init(int *argc, char **argv)
   int default_value_int;
   int i;
 
+  TRACE_add_start_function(TRACE_surf_alloc);
+  TRACE_add_start_function(TRACE_smpi_alloc);
+
+  TRACE_add_end_function(TRACE_smpi_release);
+  TRACE_add_end_function(TRACE_surf_release);
+
   /* Create the configuration support */
   if (_sg_init_status == 0) { /* Only create stuff if not already inited */
     sprintf(description,
similarity index 99%
rename from src/instr/instr_smpi.c
rename to src/smpi/instr_smpi.c
index b794d02..b4239be 100644 (file)
@@ -4,7 +4,7 @@
 /* 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. */
 
-#include "instr/instr_private.h"
+#include "private.h"
 #include "mc/mc.h"
 #include <ctype.h>
 #include <wchar.h>
index c23edc6..148f4b0 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt.h"
 #include "xbt/xbt_os_time.h"
 #include "simgrid/simix.h"
-#include "smpi/smpi.h"
+#include "smpi/smpi_interface.h"
 #include "smpi/smpif.h"
 #include "smpi/smpi_cocci.h"
 #include "instr/instr_private.h"
@@ -341,5 +341,14 @@ void mpi_sendrecv__(void* sendbuf, int* sendcount, int* sendtype, int* dst,
                 int* recvtype, int* src, int* recvtag,
                 int* comm, MPI_Status* status, int* ierr);
 
+/********** Tracing **********/
+/* from smpi_instr.c */
+void TRACE_internal_smpi_set_category (const char *category);
+const char *TRACE_internal_smpi_get_category (void);
+void TRACE_smpi_collective_in(int rank, int root, const char *operation);
+void TRACE_smpi_collective_out(int rank, int root, const char *operation);
+void TRACE_smpi_computing_init(int rank);
+void TRACE_smpi_computing_out(int rank);
+void TRACE_smpi_computing_in(int rank);
 
 #endif
similarity index 100%
rename from src/instr/instr_surf.c
rename to src/surf/instr_surf.c
index 568ded5..4732aa3 100644 (file)
@@ -200,4 +200,11 @@ XBT_PUBLIC(void) surfxml_bufferstack_pop(int new);
 
 XBT_PUBLIC_DATA(int) surfxml_bufferstack_size;
 
+/********** Tracing **********/
+/* from surf_instr.c */
+void TRACE_surf_host_set_power(double date, const char *resource, double power);
+void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
+void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
+
+
 #endif                          /* _SURF_SURF_PRIVATE_H */
index 09e9232..70a9728 100644 (file)
@@ -7,44 +7,12 @@
 #ifndef _XBT_GRAPH_PRIVATE_H
 #define _XBT_GRAPH_PRIVATE_H
 #include "xbt/dynar.h"
+#include "xbt/graph.h"
 
 #define NOT_EXPLORED 0
 #define CURRENTLY_EXPLORING 1
 #define ALREADY_EXPLORED 2
 
-/* Node structure */
-/* typedef struct xbt_node *xbt_node_t; */
-typedef struct xbt_node {
-  xbt_dynar_t out;
-  xbt_dynar_t in;               /* not used when the graph is directed */
-  double position_x;            /* positive value: negative means undefined */
-  double position_y;            /* positive value: negative means undefined */
-  void *data;                   /* user data */
-  void *xbtdata;                /* private xbt data: should be reinitialized at the
-                                   beginning of your algorithm if you need to use it */
-} s_xbt_node_t;
-
-/* edge structure */
-/* typedef struct xbt_edge *xbt_edge_t; */
-typedef struct xbt_edge {
-  xbt_node_t src;
-  xbt_node_t dst;
-  void *data;                   /* user data */
-  void *xbtdata;                /* private xbt data: should be reinitialized at the
-                                   beginning of your algorithm if you need to use it */
-  double length;                /* positive value: negative means undefined */
-} s_xbt_edge_t;
-
-/* Graph structure */
-/* typedef struct xbt_graph *xbt_graph_t; */
-typedef struct xbt_graph {
-  xbt_dynar_t nodes;
-  xbt_dynar_t edges;
-  unsigned short int directed;
-  void *data;                   /* user data */
-  void *xbtdata;                /* private xbt data: should be reinitialized at the
-                                   beginning of your algorithm if you need to use it */
-} s_xbt_graph_t;
 void xbt_floyd_algorithm(xbt_graph_t g, double *adj, double *d,
                          xbt_node_t * p);
 void xbt_graph_depth_visit(xbt_graph_t g, xbt_node_t n,