Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] new system call to make categorized host utilization tracing possible again
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 7 Dec 2010 09:56:12 +0000 (09:56 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 7 Dec 2010 09:56:12 +0000 (09:56 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9028 48e7efb5-ca39-0410-a469-dd3cf9ba447f

12 files changed:
include/simix/simix.h
src/include/surf/surf.h
src/instr/instr_msg_task.c
src/msg/gos.c
src/simix/host_private.h
src/simix/smurf_private.h
src/simix/smx_host.c
src/simix/smx_smurf.c
src/simix/smx_user.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/workstation.c

index fe8bd2f..0c60ed1 100644 (file)
@@ -117,6 +117,9 @@ XBT_PUBLIC(void) SIMIX_req_host_execution_cancel(smx_action_t execution);
 XBT_PUBLIC(double) SIMIX_req_host_execution_get_remains(smx_action_t execution);
 XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_get_state(smx_action_t execution);
 XBT_PUBLIC(void) SIMIX_req_host_execution_set_priority(smx_action_t execution, double priority);
+#ifdef HAVE_TRACING
+XBT_PUBLIC(void) SIMIX_req_host_execution_set_category(smx_action_t execution, const char *category);
+#endif
 XBT_PUBLIC(void) SIMIX_req_host_execution_wait(smx_action_t execution);
 
 
index baee26e..0b0bece 100644 (file)
@@ -271,6 +271,9 @@ typedef struct surf_model {
   int (*is_suspended) (surf_action_t action);     /**< Return whether an action is suspended */
   void (*set_max_duration) (surf_action_t action, double duration);     /**< Set the max duration of an action*/
   void (*set_priority) (surf_action_t action, double priority);     /**< Set the priority of an action */
+#ifdef HAVE_TRACING
+  void (*set_category) (surf_action_t action, const char *category); /**< Set the category of an action */
+#endif
   double (*get_remains) (surf_action_t action);     /**< Get the remains of an action */
 #ifdef HAVE_LATENCY_BOUND_TRACKING
   int (*get_latency_limited) (surf_action_t action);     /**< Return 1 if action is limited by latency, 0 otherwise */
index 5b0e9ea..4bbae37 100644 (file)
@@ -161,8 +161,6 @@ void TRACE_msg_task_execute_start(m_task_t task)
   TRACE_task_container(task, name, 200);
   if (TRACE_msg_task_is_enabled())
     pajePushState(MSG_get_clock(), "task-state", name, "execute");
-
-  TRACE_category_set(SIMIX_process_self(), task->category);
 }
 
 void TRACE_msg_task_execute_end(m_task_t task)
@@ -178,8 +176,6 @@ void TRACE_msg_task_execute_end(m_task_t task)
   if (TRACE_msg_task_is_enabled())
     pajePopState(MSG_get_clock(), "task-state", name);
 
-  TRACE_category_unset(SIMIX_process_self());
-
   DEBUG3("EXEC,out %p, %lld, %s", task, task->counter, task->category);
 }
 
index 3749d9c..ba361cc 100644 (file)
@@ -66,6 +66,9 @@ MSG_error_t MSG_task_execute(m_task_t task)
       SIMIX_req_host_execute(task->name, SIMIX_host_self(),
                            simdata->computation_amount);
   SIMIX_req_host_execution_set_priority(simdata->compute, simdata->priority);
+#ifdef HAVE_TRACING
+  SIMIX_req_host_execution_set_category(simdata->compute, task->category);
+#endif
 
   self->simdata->waiting_action = simdata->compute;
   SIMIX_req_host_execution_wait(simdata->compute);
index 63041a1..65a48b6 100644 (file)
@@ -37,6 +37,9 @@ void SIMIX_host_execution_cancel(smx_action_t action);
 double SIMIX_host_execution_get_remains(smx_action_t action);
 e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
 void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
+#ifdef HAVE_TRACING
+void SIMIX_host_execution_set_category(smx_action_t action, const char *category);
+#endif
 void SIMIX_pre_host_execution_wait(smx_req_t req);
 
 void SIMIX_host_execution_suspend(smx_action_t action);
index 7a67a35..7a80c3f 100644 (file)
@@ -24,6 +24,9 @@ typedef enum {
   REQ_HOST_EXECUTION_GET_REMAINS,
   REQ_HOST_EXECUTION_GET_STATE,
   REQ_HOST_EXECUTION_SET_PRIORITY,
+#ifdef HAVE_TRACING
+  REQ_HOST_EXECUTION_SET_CATEGORY,
+#endif
   REQ_HOST_EXECUTION_WAIT,
   REQ_PROCESS_CREATE,
   REQ_PROCESS_KILL,
@@ -170,6 +173,13 @@ typedef struct s_smx_req {
       double priority;
     } host_execution_set_priority;
 
+#ifdef HAVE_TRACING
+    struct {
+      smx_action_t execution;
+      const char *category;
+    } host_execution_set_category;
+#endif
+
     struct {
       smx_action_t execution;
     } host_execution_wait;
index 744bfc8..48ef546 100644 (file)
@@ -297,6 +297,13 @@ void SIMIX_host_execution_set_priority(smx_action_t action, double priority)
   surf_workstation_model->set_priority(action->execution.surf_exec, priority);
 }
 
+#ifdef HAVE_TRACING
+void SIMIX_host_execution_set_category(smx_action_t action, const char *category)
+{
+  surf_workstation_model->set_category(action->execution.surf_exec, category);
+}
+#endif
+
 void SIMIX_pre_host_execution_wait(smx_req_t req)
 {
   smx_action_t action = req->host_execution_wait.execution;
index 1c21595..bed8cd0 100644 (file)
@@ -193,6 +193,15 @@ void SIMIX_request_pre(smx_req_t req)
       SIMIX_request_answer(req);
       break;
 
+#ifdef HAVE_TRACING
+    case REQ_HOST_EXECUTION_SET_CATEGORY:
+      SIMIX_host_execution_set_category(
+          req->host_execution_set_category.execution,
+          req->host_execution_set_category.category);
+      SIMIX_request_answer(req);
+      break;
+#endif
+
     case REQ_HOST_EXECUTION_WAIT:
       SIMIX_pre_host_execution_wait(req);
       break;
index 60b71b1..dae8115 100644 (file)
@@ -268,6 +268,25 @@ void SIMIX_req_host_execution_set_priority(smx_action_t execution, double priori
   SIMIX_request_push(&req);
 }
 
+#ifdef HAVE_TRACING
+/**
+ * \brief Set the category of an execution action.
+ *
+ * This functions changes the priority only. It calls a surf function.
+ * \param execution The execution action
+ * \param priority The new priority
+ */
+void SIMIX_req_host_execution_set_category(smx_action_t execution, const char *category)
+{
+  s_smx_req_t req;
+
+  req.call = REQ_HOST_EXECUTION_SET_CATEGORY;
+  req.host_execution_set_category.execution = execution;
+  req.host_execution_set_category.category = xbt_strdup (category);
+  SIMIX_request_push(&req);
+}
+#endif
+
 /**
  * \brief Waits for the completion of an execution action.
  *
index e8e838b..8e5f51f 100644 (file)
@@ -387,6 +387,15 @@ static void cpu_action_set_priority(surf_action_t action, double priority)
   XBT_OUT;
 }
 
+#ifdef HAVE_TRACING
+static void cpu_action_set_category(surf_action_t action, const char *category)
+{
+  XBT_IN2("(%p,%s)", action, category);
+  action->category = xbt_strdup (category);
+  XBT_OUT;
+}
+#endif
+
 static double cpu_action_get_remains(surf_action_t action)
 {
   XBT_IN1("(%p)", action);
@@ -462,6 +471,9 @@ static void surf_cpu_model_init_internal(void)
   surf_cpu_model->is_suspended = cpu_action_is_suspended;
   surf_cpu_model->set_max_duration = cpu_action_set_max_duration;
   surf_cpu_model->set_priority = cpu_action_set_priority;
+#ifdef HAVE_TRACING
+  surf_cpu_model->set_category = cpu_action_set_category;
+#endif
   surf_cpu_model->get_remains = cpu_action_get_remains;
 
   surf_cpu_model->extension.cpu.execute = cpu_execute;
index f4dfd90..0126832 100644 (file)
@@ -522,6 +522,16 @@ static void cpu_im_action_set_priority(surf_action_t action,
   XBT_OUT;
 }
 
+#ifdef HAVE_TRACING
+static void cpu_im_action_set_category(surf_action_t action,
+                                       const char *category)
+{
+  XBT_IN2("(%p,%s)", action, category);
+  action->category = xbt_strdup (category);
+  XBT_OUT;
+}
+#endif
+
 static double cpu_im_action_get_remains(surf_action_t action)
 {
   XBT_IN1("(%p)", action);
@@ -618,6 +628,9 @@ static void surf_cpu_im_model_init_internal(void)
   surf_cpu_model->is_suspended = cpu_im_action_is_suspended;
   surf_cpu_model->set_max_duration = cpu_im_action_set_max_duration;
   surf_cpu_model->set_priority = cpu_im_action_set_priority;
+#ifdef HAVE_TRACING
+  surf_cpu_model->set_category = cpu_im_action_set_category;
+#endif
   surf_cpu_model->get_remains = cpu_im_action_get_remains;
 
   surf_cpu_model->extension.cpu.execute = cpu_im_execute;
index 4d6fd9a..1d154ba 100644 (file)
@@ -179,6 +179,18 @@ static void ws_action_set_priority(surf_action_t action, double priority)
     DIE_IMPOSSIBLE;
 }
 
+#ifdef HAVE_TRACING
+static void ws_action_set_category(surf_action_t action, const char *category)
+{
+  if (action->model_type == surf_network_model)
+    surf_network_model->set_category(action, category);
+  else if (action->model_type == surf_cpu_model)
+    surf_cpu_model->set_category(action, category);
+  else
+    DIE_IMPOSSIBLE;
+}
+#endif
+
 #ifdef HAVE_LATENCY_BOUND_TRACKING
 static int ws_get_latency_limited(surf_action_t action)
 {
@@ -295,6 +307,9 @@ static void surf_workstation_model_init_internal(void)
   surf_workstation_model->is_suspended = ws_action_is_suspended;
   surf_workstation_model->set_max_duration = ws_action_set_max_duration;
   surf_workstation_model->set_priority = ws_action_set_priority;
+#ifdef HAVE_TRACING
+  surf_workstation_model->set_category = ws_action_set_category;
+#endif
   surf_workstation_model->get_remains = ws_action_get_remains;
 #ifdef HAVE_LATENCY_BOUND_TRACKING
   surf_workstation_model->get_latency_limited = ws_get_latency_limited;