Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new functions for the MSG API (set/get task category)
authorschnorr <Lucas.Schnorr@imag.fr>
Sat, 24 Mar 2012 17:08:12 +0000 (18:08 +0100)
committerschnorr <Lucas.Schnorr@imag.fr>
Sat, 24 Mar 2012 17:08:12 +0000 (18:08 +0100)
details:
- only works if HAVE_TRACING is enabled

include/msg/msg.h
src/msg/msg_gos.c

index eed0d31..89b94ff 100644 (file)
@@ -206,6 +206,9 @@ XBT_PUBLIC(MSG_error_t)
 
 XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
 
 
 XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
 
+XBT_PUBLIC(void) MSG_task_set_category (m_task_t task, const char *category);
+XBT_PUBLIC(const char *) MSG_task_get_category (m_task_t task);
+
 /************************** Task handling ************************************/
 XBT_PUBLIC(MSG_error_t)
     MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
 /************************** Task handling ************************************/
 XBT_PUBLIC(MSG_error_t)
     MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
index cec273d..7043c04 100644 (file)
@@ -874,6 +874,45 @@ int MSG_task_listen_from(const char *alias)
   return MSG_process_get_PID(task->simdata->sender);
 }
 
   return MSG_process_get_PID(task->simdata->sender);
 }
 
+/** \ingroup msg_gos_functions
+ *
+ * See \ref tracing_tracing for details on how to trace
+ * the (categorized) resource utilization.
+ *
+ * \brief Sets the tracing category of a task.
+ *
+ * \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
  *
 #ifdef MSG_USE_DEPRECATED
 /** \ingroup msg_gos_functions
  *