Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] two new functions for the SD API (set/get tracing categories)
authorschnorr <Lucas.Schnorr@imag.fr>
Sat, 24 Mar 2012 22:00:23 +0000 (23:00 +0100)
committerschnorr <Lucas.Schnorr@imag.fr>
Sat, 24 Mar 2012 22:00:23 +0000 (23:00 +0100)
and their documentation

doc/tracing.doc
examples/simdag/simdag_trace.c
include/simdag/simdag.h
src/simdag/sd_daxloader.c
src/simdag/sd_dotloader.c
src/simdag/sd_task.c

index 6b61e35..d0e27e2 100644 (file)
@@ -51,13 +51,8 @@ $ make
 \li \c TRACE_category_with_color(const char *category, const char *color)
 \li \c MSG_task_set_category(m_task_t task, const char *category)
 \li \c MSG_task_get_category(m_task_t task)
-
-\li <b>\c TRACE_sd_set_task_category (SD_task_t task, const char *category)</b>:
-This function should be called after the creation of a SimDAG task, to define the
-category of that task. The first parameter \c task must contain a task that was
-created with the function \c MSG_task_create. The second parameter
-\c category must contain a category that was previously defined by the function
-\c TRACE_category.
+\li \c SD_task_set_category(SD_task_t task, const char *category)
+\li \c SD_task_get_category(SD_task_t task)
 
 \subsection instr_mark_functions Tracing marks functions
 \li \c TRACE_declare_mark(const char *mark_type)
index 7452e70..a39a9b8 100644 (file)
@@ -62,9 +62,9 @@ int main(int argc, char **argv)
   TRACE_category ("taskA");
   TRACE_category ("taskB");
   TRACE_category ("taskC");
-  TRACE_sd_set_task_category (taskA, "taskA");
-  TRACE_sd_set_task_category (taskB, "taskB");
-  TRACE_sd_set_task_category (taskC, "taskC");
+  SD_task_set_category (taskA, "taskA");
+  SD_task_set_category (taskB, "taskB");
+  SD_task_set_category (taskC, "taskC");
 
   /* if everything is ok, no exception is forwarded or rethrown by main() */
 
index cd50109..6dd9c2e 100644 (file)
@@ -162,6 +162,9 @@ XBT_PUBLIC(SD_task_t) SD_task_create_comm_e2e(const char *name, void *data,
 XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count,
                                    const SD_workstation_t * list);
 XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
+XBT_PUBLIC(void) SD_task_set_category (SD_task_t task, const char *category);
+XBT_PUBLIC(const char *) SD_task_get_category (SD_task_t task);
+
 
 /** @brief A constant to use in SD_task_schedule to mean that there is no cost.
  *
index c44a719..40b4e62 100644 (file)
@@ -324,7 +324,7 @@ xbt_dynar_t SD_daxload(const char *filename)
           const char *category = depafter->src->category;
           if (category){
             TRACE_category (category);
-            TRACE_sd_set_task_category (newfile, category);
+            SD_task_set_category (newfile, category);
           }
         }
 #endif
@@ -340,7 +340,7 @@ xbt_dynar_t SD_daxload(const char *filename)
           const char *category = depbefore->src->category;
           if (category){
             TRACE_category (category);
-            TRACE_sd_set_task_category (newfile, category);
+            SD_task_set_category (newfile, category);
           }
         }
 #endif
@@ -362,7 +362,7 @@ xbt_dynar_t SD_daxload(const char *filename)
             const char *category = depbefore->src->category;
             if (category){
               TRACE_category (category);
-              TRACE_sd_set_task_category (newfile, category);
+              SD_task_set_category (newfile, category);
             }
           }
 #endif
@@ -409,7 +409,7 @@ void STag_dax__job(void)
   char *category = A_dax__job_name;
   if (category){
     TRACE_category (category);
-    TRACE_sd_set_task_category(current_job, category);
+    SD_task_set_category(current_job, category);
   }
 #endif
   xbt_dict_set(jobs, A_dax__job_id, current_job, NULL);
index 8ee8eac..8d15084 100644 (file)
@@ -87,7 +87,7 @@ static void TRACE_sd_dotloader (SD_task_t task, const char *category)
   if (category){
     if (strlen (category) != 0){
       TRACE_category (category);
-      TRACE_sd_set_task_category (task, category);
+      SD_task_set_category (task, category);
     }
   }
 }
index d1de261..4070449 100644 (file)
@@ -1401,3 +1401,43 @@ void SD_task_schedulel(SD_task_t task, int count, ...)
   SD_task_schedulev(task, count, list);
   free(list);
 }
+
+/**
+ * \brief Sets the tracing category of a task.
+ *
+ * This function should be called after the creation of a
+ * SimDAG task, to define the category of that task. The first
+ * parameter must contain a task that was created with the
+ * function #SD_task_create. The second parameter must contain
+ * a category that was previously declared with the function
+ * #TRACE_category.
+ *
+ * \param task The task to be considered
+ * \param category the name of the category to be associated to the task
+ *
+ * \see SD_task_get_category, TRACE_category, TRACE_category_with_color
+ */
+void SD_task_set_category (SD_task_t task, const char *category)
+{
+#ifdef HAVE_TRACING
+  TRACE_sd_set_task_category (task, category);
+#endif
+}
+
+/**
+ * \brief Gets the current tracing category of a task.
+ *
+ * \param task The task to be considered
+ *
+ * \see SD_task_set_category
+ *
+ * \return Returns the name of the tracing category of the given task, NULL otherwise
+ */
+const char *SD_task_get_category (SD_task_t task)
+{
+#ifdef HAVE_TRACING
+  return task->category;
+#else
+  return NULL;
+#endif
+}