Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] two new functions for the SD API (set/get tracing categories)
[simgrid.git] / src / simdag / sd_task.c
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
+}