Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] improve documentation of tracing API, make tracing.doc points to them
[simgrid.git] / src / msg / msg_gos.c
index cec273dd3bc6c1e7f250ee6b8bd1ca59a87d1e04..2205fcdc5d321d5688f4ea2802a2c242825e87af 100644 (file)
@@ -874,6 +874,51 @@ int MSG_task_listen_from(const char *alias)
   return MSG_process_get_PID(task->simdata->sender);
 }
 
+/** \ingroup msg_gos_functions
+ * \brief Sets the tracing category of a task.
+ *
+ * This function should be called after the creation of
+ * a MSG task, to define the category of that task. The
+ * first parameter #task must contain a task that was
+ * created with the function #MSG_task_create. The second
+ * parameter #category must contain a category that was
+ * previously declared with the function #TRACE_category
+ * (or with #TRACE_category_with_color).
+ *
+ * See \ref tracing_tracing for details on how to trace
+ * the (categorized) resource utilization.
+ *
+ * \param task the task that is going to be categorized
+ * \param category the name of the category to be associated to the task
+ *
+ * \see MSG_task_get_category, TRACE_category, TRACE_category_with_color
+ */
+void MSG_task_set_category (m_task_t task, const char *category)
+{
+#ifdef HAVE_TRACING
+  TRACE_msg_set_task_category (task, category);
+#endif
+}
+
+/** \ingroup msg_gos_functions
+ *
+ * \brief Gets the current tracing category of a task.
+ *
+ * \param task the task to be considered
+ *
+ * \see MSG_task_set_category
+ *
+ * \return Returns the name of the tracing category of the given task, NULL otherwise
+ */
+const char *MSG_task_get_category (m_task_t task)
+{
+#ifdef HAVE_TRACING
+  return task->category;
+#else
+  return NULL;
+#endif
+}
+
 #ifdef MSG_USE_DEPRECATED
 /** \ingroup msg_gos_functions
  *