Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
moving TRACE_smpi_set_category to smpi_mpi.c so function can call smpi_bench_*
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 28 Oct 2010 11:44:17 +0000 (11:44 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 28 Oct 2010 11:44:17 +0000 (11:44 +0000)
details:
- since smpi_bench_end generates a execute task, we have
to call smpi_bench_end before changing the process's category
- if we don't do so, we end up with a new category to an execute
action that should have the process's old category
- function prototype is kept in instr/instr.h

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8470 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/interface.c
src/smpi/smpi_mpi.c

index a405db2..524bde4 100644 (file)
@@ -225,19 +225,4 @@ void TRACE_mark(const char *mark_type, const char *mark_value)
   pajeNewEvent(MSG_get_clock(), mark_type, "0", mark_value);
 }
 
-int TRACE_smpi_set_category(const char *category)
-{
-  //if category is NULL, trace of platform is disabled
-  if (!IS_TRACING)
-    return 1;
-  if (category != NULL) {
-    int ret = TRACE_category(category);
-    TRACE_category_set(SIMIX_process_self(), category);
-    return ret;
-  } else {
-    TRACE_category_unset(SIMIX_process_self());
-    return 0;
-  }
-}
-
 #endif                          /* HAVE_TRACING */
index bc4b3cb..39b2926 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
                                 "Logging specific to SMPI (mpi)");
 
+#ifdef HAVE_TRACING
+//this function need to be here because of the calls to smpi_bench
+int TRACE_smpi_set_category(const char *category)
+{
+  //need to end bench otherwise categories for execution tasks are wrong
+  smpi_bench_end (-1, NULL);
+  int ret;
+  if (!IS_TRACING){
+    ret = 1;
+  }else{
+    if (category != NULL) {
+      ret = TRACE_category(category);
+      TRACE_category_set(SIMIX_process_self(), category);
+    }else{
+      //if category is NULL, trace of platform is disabled for this process
+      TRACE_category_unset(SIMIX_process_self());
+      ret = 0;
+    }
+  }
+  //begin bench after changing process's category
+  smpi_bench_begin (-1, NULL);
+  return ret;
+}
+#endif
+
 /* MPI User level calls */
 
 int MPI_Init(int *argc, char ***argv)