Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] paje file format has evolved with a new event PajeResetState, follow it
authorschnorr <Lucas.Schnorr@imag.fr>
Thu, 7 Jun 2012 15:30:21 +0000 (17:30 +0200)
committerschnorr <Lucas.Schnorr@imag.fr>
Thu, 7 Jun 2012 15:39:58 +0000 (17:39 +0200)
include/instr/instr.h
src/instr/instr_interface.c
src/instr/instr_paje_trace.c
src/instr/instr_private.h

index ccd354e..cefa435 100644 (file)
@@ -74,6 +74,7 @@ XBT_PUBLIC(void) TRACE_host_state_declare_value (const char *state, const char *
 XBT_PUBLIC(void) TRACE_host_set_state (const char *host, const char *state, const char *value);
 XBT_PUBLIC(void) TRACE_host_push_state (const char *host, const char *state, const char *value);
 XBT_PUBLIC(void) TRACE_host_pop_state (const char *host, const char *state);
+XBT_PUBLIC(void) TRACE_host_reset_state (const char *host, const char *state);
 
 /* for creating graph configuration files for Triva by hand */
 XBT_PUBLIC(xbt_dynar_t) TRACE_get_node_types (void);
index 26daa66..de4e65f 100644 (file)
@@ -829,7 +829,7 @@ void TRACE_host_state_declare_value (const char *state, const char *value, const
  *  \param state The name of the state previously declared.
  *  \param value The new value of the state.
  *
- *  \see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state
+ *  \see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
 void TRACE_host_set_state (const char *host, const char *state, const char *value)
 {
@@ -852,7 +852,7 @@ void TRACE_host_set_state (const char *host, const char *state, const char *valu
  *  \param state The name of the state previously declared.
  *  \param value The value to be pushed.
  *
- *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state
+ *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
 void TRACE_host_push_state (const char *host, const char *state, const char *value)
 {
@@ -874,7 +874,7 @@ void TRACE_host_push_state (const char *host, const char *state, const char *val
  *  \param host The name of the host to be considered.
  *  \param state The name of the state to be popped.
  *
- *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state
+ *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state, TRACE_host_reset_state
  */
 void TRACE_host_pop_state (const char *host, const char *state)
 {
@@ -883,6 +883,23 @@ void TRACE_host_pop_state (const char *host, const char *state)
   new_pajePopState(MSG_get_clock(), container, type);
 }
 
+/** \ingroup TRACE_user_variables
+ *  \brief Reset the state of a given host.
+ *
+ *  Clear all previous values of a user state.
+ *
+ *  \param host The name of the host to be considered.
+ *  \param state The name of the state to be cleared.
+ *
+ *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state, TRACE_host_pop_state
+ */
+void TRACE_host_reset_state (const char *host, const char *state)
+{
+  container_t container = PJ_container_get(host);
+  type_t type = PJ_type_get (state, container->type);
+  new_pajeResetState(MSG_get_clock(), container, type);
+}
+
 /** \ingroup TRACE_API
  *  \brief Get Paje container types that can be mapped to the nodes of a graph.
  *
index 916e18a..df1b98f 100644 (file)
@@ -25,6 +25,7 @@ typedef enum {
   PAJE_SetState,
   PAJE_PushState,
   PAJE_PopState,
+  PAJE_ResetState,
   PAJE_StartLink,
   PAJE_EndLink,
   PAJE_NewEvent
@@ -122,6 +123,12 @@ typedef struct s_popState {
   type_t type;
 }s_popState_t;
 
+typedef struct s_resetState *resetState_t;
+typedef struct s_resetState {
+  container_t container;
+  type_t type;
+}s_resetState_t;
+
 typedef struct s_startLink *startLink_t;
 typedef struct s_startLink {
   container_t container;
@@ -291,6 +298,11 @@ void TRACE_paje_create_header(void)
 %%       Type string \n\
 %%       Container string \n\
 %%EndEventDef\n\
+%%EventDef PajeResetState %d \n\
+%%       Time date \n\
+%%       Type string \n\
+%%       Container string \n\
+%%EndEventDef\n\
 %%EventDef PajeStartLink %d \n\
 %%       Time date \n\
 %%       Type string \n\
@@ -327,6 +339,7 @@ void TRACE_paje_create_header(void)
   PAJE_SetState,
   PAJE_PushState,
   PAJE_PopState,
+  PAJE_ResetState,
   PAJE_StartLink,
   PAJE_EndLink,
   PAJE_NewEvent);
@@ -572,6 +585,23 @@ static void print_pajePopState(paje_event_t event)
   }
 }
 
+static void print_pajeResetState(paje_event_t event)
+{
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp);
+  if (event->timestamp == 0){
+    fprintf(tracing_file, "%d 0 %s %s\n",
+        (int)event->event_type,
+        ((resetState_t)event->data)->type->id,
+        ((resetState_t)event->data)->container->id);
+  }else{
+    fprintf(tracing_file, "%d %lf %s %s\n",
+        (int)event->event_type,
+        event->timestamp,
+        ((resetState_t)event->data)->type->id,
+        ((resetState_t)event->data)->container->id);
+  }
+}
+
 static void print_pajeStartLink(paje_event_t event)
 {
   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp);
@@ -898,6 +928,23 @@ void new_pajePopState (double timestamp, container_t container, type_t type)
   insert_into_buffer (event);
 }
 
+
+void new_pajeResetState (double timestamp, container_t container, type_t type)
+{
+  paje_event_t event = xbt_new0(s_paje_event_t, 1);
+  event->event_type = PAJE_ResetState;
+  event->timestamp = timestamp;
+  event->print = print_pajeResetState;
+  event->free = free_paje_event;
+  event->data = xbt_new0(s_resetState_t, 1);
+  ((resetState_t)(event->data))->type = type;
+  ((resetState_t)(event->data))->container = container;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp);
+
+  insert_into_buffer (event);
+}
+
 void new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key)
 {
   paje_event_t event = xbt_new0(s_paje_event_t, 1);
index c11427f..0bc4f9d 100644 (file)
@@ -98,6 +98,7 @@ void new_pajeSubVariable (double timestamp, container_t container, type_t type,
 void new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
 void new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
 void new_pajePopState (double timestamp, container_t container, type_t type);
+void new_pajeResetState (double timestamp, container_t container, type_t type);
 void new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
 void new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
 void new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);