Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix bugs due to subVariable method
authorTakishipp <toufik.boubehziz@gmail.com>
Tue, 4 Apr 2017 13:29:32 +0000 (15:29 +0200)
committerTakishipp <toufik.boubehziz@gmail.com>
Tue, 4 Apr 2017 13:29:32 +0000 (15:29 +0200)
src/instr/instr_interface.cpp
src/instr/instr_private.h
src/instr/instr_resource_utilization.cpp
src/instr/instr_trace.cpp

index 2952e59..d1881f7 100644 (file)
@@ -284,6 +284,7 @@ static void instr_user_variable(double time, const char *resource, const char *v
   }else{
     if (created) { // declared, let's work
       char valuestr[100];
   }else{
     if (created) { // declared, let's work
       char valuestr[100];
+      s_subVariable n; 
       snprintf(valuestr, 100, "%g", value);
       container_t container = PJ_container_get(resource);
       type_t type = PJ_type_get (variable, container->type);
       snprintf(valuestr, 100, "%g", value);
       container_t container = PJ_container_get(resource);
       type_t type = PJ_type_get (variable, container->type);
@@ -295,7 +296,7 @@ static void instr_user_variable(double time, const char *resource, const char *v
         new_pajeAddVariable(time, container, type, value);
         break;
       case INSTR_US_SUB:
         new_pajeAddVariable(time, container, type, value);
         break;
       case INSTR_US_SUB:
-        new_pajeSubVariable(time, container, type, value);
+        n.new_pajeSubVariable(time, container, type, value);
         break;
       default:
         THROW_IMPOSSIBLE;
         break;
       default:
         THROW_IMPOSSIBLE;
index 3a6b86e..36615e6 100644 (file)
@@ -66,8 +66,8 @@ typedef struct s_type {
   xbt_dict_t values; //valid for all types except variable and container
 }s_type_t;
 
   xbt_dict_t values; //valid for all types except variable and container
 }s_type_t;
 
+//--------------------------------------------------
 class s_val;
 class s_val;
-
 typedef s_val *val_t;
 
 class s_val {
 typedef s_val *val_t;
 
 class s_val {
@@ -77,9 +77,9 @@ class s_val {
   char *color;
   type_t father;
 };
   char *color;
   type_t father;
 };
-
 typedef s_val s_val_t;
 
 typedef s_val s_val_t;
 
+//--------------------------------------------------
 typedef enum {
   INSTR_HOST,
   INSTR_LINK,
 typedef enum {
   INSTR_HOST,
   INSTR_LINK,
@@ -91,21 +91,25 @@ typedef enum {
   INSTR_MSG_TASK
 } e_container_types;
 
   INSTR_MSG_TASK
 } e_container_types;
 
-typedef struct s_container *container_t;
-typedef struct s_container {
+//--------------------------------------------------
+class s_container;
+typedef s_container *container_t;
+
+class s_container {
+  public: 
   sg_netpoint_t netpoint;
   char *name;     /* Unique name of this container */
   char *id;       /* Unique id of this container */
   type_t type;    /* Type of this container */
   int level;      /* Level in the hierarchy, root level is 0 */
   e_container_types kind; /* This container is of what kind */
   sg_netpoint_t netpoint;
   char *name;     /* Unique name of this container */
   char *id;       /* Unique id of this container */
   type_t type;    /* Type of this container */
   int level;      /* Level in the hierarchy, root level is 0 */
   e_container_types kind; /* This container is of what kind */
-  struct s_container *father;
+  s_container *father;
   xbt_dict_t children;
   xbt_dict_t children;
-}s_container_t;
-
+};
+typedef s_container s_container_t;
 
 
+//--------------------------------------------------
 class paje_event;
 class paje_event;
-
 typedef paje_event *paje_event_t;
 
 class paje_event {
 typedef paje_event *paje_event_t;
 
 class paje_event {
@@ -116,8 +120,8 @@ class paje_event {
   void (*free) (paje_event_t event);
   void *data;
 };
   void (*free) (paje_event_t event);
   void *data;
 };
-
 typedef paje_event s_paje_event_t;
 typedef paje_event s_paje_event_t;
+//--------------------------------------------------
 
 typedef struct s_defineContainerType *defineContainerType_t;
 typedef struct s_defineContainerType {
 
 typedef struct s_defineContainerType *defineContainerType_t;
 typedef struct s_defineContainerType {
@@ -175,12 +179,21 @@ typedef struct s_addVariable {
   double value;
 }s_addVariable_t;
 
   double value;
 }s_addVariable_t;
 
-typedef struct s_subVariable *subVariable_t;
-typedef struct s_subVariable {
+//--------------------------------------------------
+class s_subVariable;
+
+typedef s_subVariable *subVariable_t;
+
+class s_subVariable {
+  public:
   container_t container;
   type_t type;
   double value;
   container_t container;
   type_t type;
   double value;
-}s_subVariable_t;
+  //methods 
+  XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
+};
+typedef s_subVariable s_subVariable_t;
+//--------------------------------------------------
 
 class s_setState;
 
 
 class s_setState;
 
@@ -285,7 +298,7 @@ XBT_PUBLIC(void) new_pajeDestroyContainer (container_t container);
 
 XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
 XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
 
 XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
 XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
-XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
+
 
 XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
 XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
 
 XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
 XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
index c7b0bcd..bebb4cd 100644 (file)
@@ -36,10 +36,10 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, const char *vari
 }
 
 static void instr_event (double now, double delta, type_t variable, container_t resource, double value)
 }
 
 static void instr_event (double now, double delta, type_t variable, container_t resource, double value)
-{
+{ s_subVariable n;
   __TRACE_surf_check_variable_set_to_zero(now, variable->name, resource->name);
   new_pajeAddVariable(now, resource, variable, value);
   __TRACE_surf_check_variable_set_to_zero(now, variable->name, resource->name);
   new_pajeAddVariable(now, resource, variable, value);
-  new_pajeSubVariable(now + delta, resource, variable, value);
+  n.new_pajeSubVariable(now + delta, resource, variable, value);
 }
 
 /* TRACE_surf_link_set_utilization: entry point from SimGrid */
 }
 
 /* TRACE_surf_link_set_utilization: entry point from SimGrid */
index e19005a..0580aa2 100644 (file)
@@ -296,7 +296,7 @@ void new_pajeAddVariable (double timestamp, container_t container, type_t type,
   insert_into_buffer (event);
 }
 
   insert_into_buffer (event);
 }
 
-void new_pajeSubVariable (double timestamp, container_t container, type_t type, double value)
+void s_subVariable_t::new_pajeSubVariable (double timestamp, container_t container, type_t type, double value)
 {
   paje_event_t event                        = xbt_new0(s_paje_event_t, 1);
   event->event_type                         = PAJE_SubVariable;
 {
   paje_event_t event                        = xbt_new0(s_paje_event_t, 1);
   event->event_type                         = PAJE_SubVariable;