DEBUG2("MARK %s %s", mark_type, mark_value);
type_t type = getEventType (mark_type, NULL, getRootContainer()->type);
- new_pajeNewEvent (MSG_get_clock(), getRootContainer(), type, mark_value);
+ val_t value = getValue (mark_value, NULL, type);
+ new_pajeNewEvent (MSG_get_clock(), getRootContainer(), type, value);
}
//set the state of this new container
type = getType ("MSG_PROCESS_STATE", msg->type);
- new_pajeSetState (MSG_get_clock(), msg, type, "executing");
+ val_t value = getValueByName ("executing", type);
+ new_pajeSetState (MSG_get_clock(), msg, type, value);
//end link
msg = getContainer(instr_process_id(process, str, len));
container_t msg = newContainer(instr_process_id(process, str, len), INSTR_MSG_PROCESS, host_container);
type_t type = getType ("MSG_PROCESS_STATE", msg->type);
- new_pajeSetState (MSG_get_clock(), msg, type, "executing");
+ val_t value = getValueByName ("executing", type);
+ new_pajeSetState (MSG_get_clock(), msg, type, value);
}
}
container_t process_container = getContainer (instr_process_id(process, str, len));
type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
- new_pajePushState (MSG_get_clock(), process_container, type, "suspend");
+ val_t value = getValueByName ("suspend", type);
+ new_pajePushState (MSG_get_clock(), process_container, type, value);
}
}
container_t process_container = getContainer (instr_process_id(process, str, len));
type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
- new_pajePushState (MSG_get_clock(), process_container, type, "sleep");
+ val_t value = getValueByName ("sleep", type);
+ new_pajePushState (MSG_get_clock(), process_container, type, value);
}
}
new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
type = getType ("MSG_TASK_STATE", msg->type);
- new_pajePushState (MSG_get_clock(), msg, type, "created");
+ val_t value = getValueByName ("created", type);
+ new_pajePushState (MSG_get_clock(), msg, type, value);
}
}
if (TRACE_msg_task_is_enabled()){
container_t task_container = getContainer (task->name);
type_t type = getType ("MSG_TASK_STATE", task_container->type);
- new_pajePushState (MSG_get_clock(), task_container, type, "MSG_task_execute");
+ val_t value = getValueByName ("MSG_task_execute", type);
+ new_pajePushState (MSG_get_clock(), task_container, type, value);
}
if (TRACE_msg_process_is_enabled()){
container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
- new_pajePushState (MSG_get_clock(), process_container, type, "task_execute");
+ val_t value = getValueByName ("task_execute", type);
+ new_pajePushState (MSG_get_clock(), process_container, type, value);
}
}
container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
- new_pajePushState (MSG_get_clock(), process_container, type, "receive");
+ val_t value = getValueByName ("receive", type);
+ new_pajePushState (MSG_get_clock(), process_container, type, value);
}
}
new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
type = getType ("MSG_TASK_STATE", msg->type);
- new_pajePushState (MSG_get_clock(), msg, type, "created");
+ val_t value = getValueByName ("created", type);
+ new_pajePushState (MSG_get_clock(), msg, type, value);
type = getType ("MSG_TASK_LINK", getRootType());
char key[INSTR_DEFAULT_STR_SIZE];
container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
- new_pajePushState (MSG_get_clock(), process_container, type, "send");
+ val_t value = getValueByName ("send", type);
+ new_pajePushState (MSG_get_clock(), process_container, type, value);
char key[INSTR_DEFAULT_STR_SIZE];
snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
rootContainer = root;
}
+static val_t newValue (const char *valuename, const char *color, type_t father)
+{
+ val_t ret = xbt_new0(s_val_t, 1);
+ ret->name = xbt_strdup (valuename);
+ ret->father = father;
+ ret->color = xbt_strdup (color);
+
+ static long long int type_id = 0;
+ char str_id[INSTR_DEFAULT_STR_SIZE];
+ snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "v%lld", type_id++);
+ ret->id = xbt_strdup (str_id);
+
+ xbt_dict_set (father->values, valuename, ret, NULL);
+ DEBUG2("new value %s, child of %s", ret->name, ret->father->name);
+ return ret;
+}
+
+val_t getValue (const char *valuename, const char *color, type_t father)
+{
+ if (father->kind == TYPE_VARIABLE) return NULL; //Variables can't have different values
+
+ val_t ret = (val_t)xbt_dict_get_or_null (father->values, valuename);
+ if (ret == NULL){
+ ret = newValue (valuename, color, father);
+ DEBUG4("EntityValue %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ new_pajeDefineEntityValue(ret);
+ }
+ return ret;
+}
+
+val_t getValueByName (const char *valuename, type_t father)
+{
+ return getValue (valuename, NULL, father);
+}
+
static type_t newType (const char *typename, const char *key, const char *color, e_entity_types kind, type_t father)
{
type_t ret = xbt_new0(s_type_t, 1);
ret->father = father;
ret->kind = kind;
ret->children = xbt_dict_new ();
+ ret->values = xbt_dict_new ();
ret->color = xbt_strdup (color);
static long long int type_id = 0;
PAJE_DefineStateType,
PAJE_DefineEventType,
PAJE_DefineLinkType,
+ PAJE_DefineEntityValue,
PAJE_CreateContainer,
PAJE_DestroyContainer,
PAJE_SetVariable,
type_t dest;
}s_defineLinkType_t;
+typedef struct s_defineEntityValue *defineEntityValue_t;
+typedef struct s_defineEntityValue {
+ val_t value;
+}s_defineEntityValue_t;
+
typedef struct s_createContainer *createContainer_t;
typedef struct s_createContainer {
container_t container;
typedef struct s_setState {
container_t container;
type_t type;
- char *value;
+ val_t value;
}s_setState_t;
typedef struct s_pushState *pushState_t;
typedef struct s_pushState {
container_t container;
type_t type;
- char *value;
+ val_t value;
}s_pushState_t;
typedef struct s_popState *popState_t;
typedef struct s_newEvent {
container_t container;
type_t type;
- char *value;
+ val_t value;
}s_newEvent_t;
static FILE *tracing_file = NULL;
%% DestContainerType string \n\
%% Name string \n\
%%EndEventDef \n\
+%%EventDef PajeDefineEntityValue %d \n\
+%% Alias string \n\
+%% EntityType string \n\
+%% Name string \n\
+%% Color color \n\
+%%EndEventDef \n\
%%EventDef PajeCreateContainer %d \n\
%% Time date \n\
%% Alias string \n\
PAJE_DefineStateType,
PAJE_DefineEventType,
PAJE_DefineLinkType,
+ PAJE_DefineEntityValue,
PAJE_CreateContainer,
PAJE_DestroyContainer,
PAJE_SetVariable,
((defineLinkType_t)event->data)->type->name);
}
+static void print_pajeDefineEntityValue (paje_event_t event)
+{
+ DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ fprintf(tracing_file, "%d %s %s %s \"%s\"\n",
+ event->event_type,
+ ((defineEntityValue_t)event->data)->value->id,
+ ((defineEntityValue_t)event->data)->value->father->id,
+ ((defineEntityValue_t)event->data)->value->name,
+ ((defineEntityValue_t)event->data)->value->color);
+}
+
static void print_pajeCreateContainer(paje_event_t event)
{
DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
event->event_type,
((setState_t)event->data)->type->id,
((setState_t)event->data)->container->id,
- ((setState_t)event->data)->value);
+ ((setState_t)event->data)->value->id);
}else{
fprintf(tracing_file, "%d %lf %s %s %s\n",
event->event_type,
event->timestamp,
((setState_t)event->data)->type->id,
((setState_t)event->data)->container->id,
- ((setState_t)event->data)->value);
+ ((setState_t)event->data)->value->id);
}
}
event->event_type,
((pushState_t)event->data)->type->id,
((pushState_t)event->data)->container->id,
- ((pushState_t)event->data)->value);
+ ((pushState_t)event->data)->value->id);
}else{
fprintf(tracing_file, "%d %lf %s %s %s\n",
event->event_type,
event->timestamp,
((pushState_t)event->data)->type->id,
((pushState_t)event->data)->container->id,
- ((pushState_t)event->data)->value);
+ ((pushState_t)event->data)->value->id);
}
}
event->event_type,
((newEvent_t)event->data)->type->id,
((newEvent_t)event->data)->container->id,
- ((newEvent_t)event->data)->value);
+ ((newEvent_t)event->data)->value->id);
}else{
fprintf(tracing_file, "%d %lf %s %s %s\n",
event->event_type,
event->timestamp,
((newEvent_t)event->data)->type->id,
((newEvent_t)event->data)->container->id,
- ((newEvent_t)event->data)->value);
+ ((newEvent_t)event->data)->value->id);
}
}
static void free_paje_event (paje_event_t event)
{
DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
- if (event->event_type == PAJE_SetState) {
- xbt_free (((setState_t)(event->data))->value);
- }else if (event->event_type == PAJE_PushState) {
- xbt_free (((pushState_t)(event->data))->value);
- }else if (event->event_type == PAJE_NewEvent){
- xbt_free (((newEvent_t)(event->data))->value);
- }else if (event->event_type == PAJE_StartLink){
+ if (event->event_type == PAJE_StartLink){
xbt_free (((startLink_t)(event->data))->value);
xbt_free (((startLink_t)(event->data))->key);
}else if (event->event_type == PAJE_EndLink){
event->free (event);
}
+void new_pajeDefineEntityValue (val_t value)
+{
+ paje_event_t event = xbt_new0(s_paje_event_t, 1);
+ event->event_type = PAJE_DefineEntityValue;
+ event->timestamp = 0;
+ event->print = print_pajeDefineEntityValue;
+ event->free = free_paje_event;
+ event->data = xbt_new0(s_defineEntityValue_t, 1);
+ ((defineEntityValue_t)(event->data))->value = value;
+
+ DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+
+ //print it
+ event->print (event);
+ event->free (event);
+}
+
void new_pajeCreateContainer (container_t container)
{
paje_event_t event = xbt_new0(s_paje_event_t, 1);
insert_into_buffer (event);
}
-void new_pajeSetState (double timestamp, container_t container, type_t type, const char *value)
+void new_pajeSetState (double timestamp, container_t container, type_t type, val_t value)
{
paje_event_t event = xbt_new0(s_paje_event_t, 1);
event->event_type = PAJE_SetState;
event->data = xbt_new0(s_setState_t, 1);
((setState_t)(event->data))->type = type;
((setState_t)(event->data))->container = container;
- ((setState_t)(event->data))->value = xbt_strdup(value);
+ ((setState_t)(event->data))->value = value;
DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
}
-void new_pajePushState (double timestamp, container_t container, type_t type, const char *value)
+void new_pajePushState (double timestamp, container_t container, type_t type, val_t value)
{
paje_event_t event = xbt_new0(s_paje_event_t, 1);
event->event_type = PAJE_PushState;
event->data = xbt_new0(s_pushState_t, 1);
((pushState_t)(event->data))->type = type;
((pushState_t)(event->data))->container = container;
- ((pushState_t)(event->data))->value = xbt_strdup(value);
+ ((pushState_t)(event->data))->value = value;
DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
-void new_pajeNewEvent (double timestamp, container_t container, type_t type, const char *value)
+void new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value)
{
paje_event_t event = xbt_new0(s_paje_event_t, 1);
event->event_type = PAJE_NewEvent;
event->data = xbt_new0(s_newEvent_t, 1);
((newEvent_t)(event->data))->type = type;
((newEvent_t)(event->data))->container = container;
- ((newEvent_t)(event->data))->value = xbt_strdup(value);
+ ((newEvent_t)(event->data))->value = value;
DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
e_entity_types kind;
struct s_type *father;
xbt_dict_t children;
+ xbt_dict_t values; //valid for all types except variable and container
}s_type_t;
+typedef struct s_val *val_t;
+typedef struct s_val {
+ char *id;
+ char *name;
+ char *color;
+ type_t father;
+}s_val_t;
+
typedef enum {
INSTR_HOST,
INSTR_LINK,
void new_pajeDefineStateType(type_t type);
void new_pajeDefineEventType(type_t type);
void new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
+void new_pajeDefineEntityValue (val_t type);
void new_pajeCreateContainer (container_t container);
void new_pajeDestroyContainer (container_t container);
void new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
void new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
void new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
-void new_pajeSetState (double timestamp, container_t container, type_t type, const char *value);
-void new_pajePushState (double timestamp, container_t container, type_t type, const char *value);
+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_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, const char *value);
+void new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
/* declaration of instrumentation functions from msg_task_instr.c */
char *TRACE_task_container(m_task_t task, char *output, int len);
type_t getLinkType (const char *name, type_t father, type_t source, type_t dest);
type_t getStateType (const char *name, type_t father);
type_t getType (const char *name, type_t father);
+val_t getValue (const char *valuename, const char *color, type_t father);
+val_t getValueByName (const char *valuename, type_t father);
void destroyContainer (container_t container);
void destroyAllContainers (void);
if (TRACE_msg_process_is_enabled()) {
type_t msg_process = getContainerType("MSG_PROCESS", new->type);
- getStateType ("MSG_PROCESS_STATE", msg_process);
+ type_t state = getStateType ("MSG_PROCESS_STATE", msg_process);
+ getValue ("executing", "0 1 0", state);
+ getValue ("suspend", "1 0 1", state);
+ getValue ("sleep", "1 1 0", state);
+ getValue ("receive", "1 0 0", state);
+ getValue ("send", "0 0 1", state);
+ getValue ("task_execute", "0 1 1", state);
getLinkType ("MSG_PROCESS_LINK", getRootType(), msg_process, msg_process);
getLinkType ("MSG_PROCESS_TASK_LINK", getRootType(), msg_process, msg_process);
}
if (TRACE_msg_task_is_enabled()) {
type_t msg_task = getContainerType ("MSG_TASK", new->type);
- getStateType ("MSG_TASK_STATE", msg_task);
+ type_t state = getStateType ("MSG_TASK_STATE", msg_task);
+ getValue ("MSG_task_execute", "0 1 0", state);
+ getValue ("created", "1 1 0", state);
getLinkType ("MSG_TASK_LINK", getRootType(), msg_task, msg_task);
}
}
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = getContainer (str);
type_t type = getType ("MPI_STATE", container->type);
+ val_t value = getValue (operation, "1 1 1", type);
- new_pajePushState (SIMIX_get_clock(), container, type, operation);
+ new_pajePushState (SIMIX_get_clock(), container, type, value);
}
void TRACE_smpi_collective_out(int rank, int root, const char *operation)
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = getContainer (str);
type_t type = getType ("MPI_STATE", container->type);
+ val_t value = getValue (operation, "1 1 1", type);
- new_pajePushState (SIMIX_get_clock(), container, type, operation);
+ new_pajePushState (SIMIX_get_clock(), container, type, value);
}
void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation)