mark_color = white;
XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
- s_val rett(mark_value, mark_color, type);
+ value rett(mark_value, mark_color, type);
}
/** \ingroup TRACE_mark
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
}
- val_t value = s_val::PJ_value_get (mark_value, type);
XBT_DEBUG("MARK %s %s", mark_type, mark_value);
- new NewEvent (MSG_get_clock(), PJ_container_get_root(), type, value);
+ new NewEvent(MSG_get_clock(), PJ_container_get_root(), type, value::get(mark_value, type));
}
/** \ingroup TRACE_mark
*
* \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)
+void TRACE_host_set_state(const char* host, const char* state, const char* value_str)
{
container_t container = PJ_container_get(host);
type_t type = PJ_type_get (state, container->type);
- val_t val = s_val::PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+ value* val =
+ value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
new SetStateEvent(MSG_get_clock(), container, type, val);
}
*
* \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)
+void TRACE_host_push_state(const char* host, const char* state, const char* value_str)
{
container_t container = PJ_container_get(host);
type_t type = PJ_type_get (state, container->type);
- val_t val = s_val::PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+ value* val =
+ value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
new PushStateEvent(MSG_get_clock(), container, type, val);
}
}
}
-void LogEntityValue (val_t value)
+void LogEntityValue(value* val)
{
XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineEntityValue);
//print it
if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
stream << PAJE_DefineEntityValue;
- stream << " " << value->id << " " << value->father->id << " " << value->name;
- if (value->color)
- stream << " \"" << value->color << "\"";
+ stream << " " << val->id << " " << val->father->id << " " << val->name;
+ if (val->color)
+ stream << " \"" << val->color << "\"";
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-SetStateEvent::SetStateEvent (double timestamp, container_t container, type_t type, val_t value)
+SetStateEvent::SetStateEvent(double timestamp, container_t container, type_t type, value* val)
{
this->event_type = PAJE_SetState;
this->timestamp = timestamp;
this->type = type;
this->container = container;
- this->value = value;
+ this->val = val;
#if HAVE_SMPI
if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
stream << (int)this->event_type;
print_timestamp(this);
stream << " " << type->id << " " << container->id;
- stream << " " << value->id;
+ stream << " " << val->id;
#if HAVE_SMPI
if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
stream << " \"" << filename << "\" " << linenumber;
}
}
-PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value, void* extra)
+PushStateEvent::PushStateEvent(double timestamp, container_t container, type_t type, value* val, void* extra)
{
this->event_type = PAJE_PushState;
this->timestamp = timestamp;
this->type = type;
this->container = container;
- this->value = value;
+ this->val = val;
this->extra_ = extra;
#if HAVE_SMPI
insert_into_buffer (this);
}
-PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value)
- : PushStateEvent(timestamp, container, type, value, nullptr)
+PushStateEvent::PushStateEvent(double timestamp, container_t container, type_t type, value* val)
+ : PushStateEvent(timestamp, container, type, val, nullptr)
{}
void PushStateEvent::print() {
if (instr_fmt_type == instr_fmt_paje) {
stream << (int)this->event_type;
print_timestamp(this);
stream << " " << type->id << " " << container->id;
- stream << " " << value->id;
+ stream << " " << val->id;
if (TRACE_display_sizes()) {
stream << " ";
case TRACING_SSEND:
case TRACING_ISSEND:
default:
- XBT_WARN("Call from %s impossible to translate into replay command : Not implemented (yet)", value->name);
+ XBT_WARN("Call from %s impossible to translate into replay command : Not implemented (yet)", val->name);
break;
}
}
}
-NewEvent::NewEvent (double timestamp, container_t container, type_t type, val_t value)
+NewEvent::NewEvent(double timestamp, container_t container, type_t type, value* val)
{
this->event_type = PAJE_NewEvent;
this->timestamp = timestamp;
this->type = type;
this->container = container;
- this->value = value;
+ this->val = val;
XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->event_type;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << value->id;
+ stream << " " << type->id << " " << container->id << " " << val->id;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
void PJ_type_free (type_t type)
{
- val_t value;
+ value* val;
char *value_name;
xbt_dict_cursor_t cursor = nullptr;
- xbt_dict_foreach(type->values, cursor, value_name, value) {
- XBT_DEBUG("free value %s, child of %s", value->name, value->father->name);
- xbt_free(value->name);
- xbt_free(value->color);
- xbt_free(value->id);
- xbt_free(value);
+ xbt_dict_foreach (type->values, cursor, value_name, val) {
+ XBT_DEBUG("free value %s, child of %s", val->name, val->father->name);
+ xbt_free(val->name);
+ xbt_free(val->color);
+ xbt_free(val->id);
+ xbt_free(val);
}
xbt_dict_free (&type->values);
xbt_free (type->name);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)");
-s_val::s_val(const char *name, const char *color, type_t father){
+value::value(const char* name, const char* color, type_t father)
+{
if (name == nullptr || father == nullptr){
THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)");
}
- this->ret = xbt_new0(s_val, 1);
+ this->ret = xbt_new0(value, 1);
this->ret->name = xbt_strdup (name);
this->ret->father = father;
this->ret->color = xbt_strdup (color);
LogEntityValue(this->ret);
};
-val_t s_val::PJ_value_get_or_new (const char *name, const char *color, type_t father)
+value* value::get_or_new(const char* name, const char* color, type_t father)
{
- val_t ret = 0;
+ value* ret = 0;
try {
- ret = s_val::PJ_value_get(name, father);
+ ret = value::get(name, father);
}
catch(xbt_ex& e) {
- s_val rett(name, color, father);
+ value rett(name, color, father);
ret = rett.ret;
}
return ret;
}
-val_t s_val::PJ_value_get (const char *name, type_t father)
+value* value::get(const char* name, type_t father)
{
if (name == nullptr || father == nullptr){
THROWF (tracing_error, 0, "can't get a value with a nullptr name (or a nullptr father)");
if (father->kind == TYPE_VARIABLE)
THROWF(tracing_error, 0, "variables can't have different values (%s)", father->name);
- val_t ret = (val_t)xbt_dict_get_or_null (father->values, name);
+ value* ret = (value*)xbt_dict_get_or_null(father->values, name);
if (ret == nullptr) {
THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name, father->name);
}
typedef s_type s_type_t;
//--------------------------------------------------
-class s_val;
-typedef s_val *val_t;
-
-class s_val {
- public:
+class value {
+public:
char *id;
char *name;
char *color;
type_t father;
- val_t ret;
- s_val(const char *name, const char *color, type_t father);
- static val_t PJ_value_get_or_new (const char *name, const char *color, type_t father);
- static val_t PJ_value_get (const char *name, type_t father);
+ value* ret;
+ value(const char* name, const char* color, type_t father);
+ static value* get_or_new(const char* name, const char* color, type_t father);
+ static value* get(const char* name, type_t father);
};
private:
container_t container;
type_t type;
- val_t value;
+ value* val;
const char* filename;
int linenumber;
public:
- SetStateEvent (double timestamp, container_t container, type_t type, val_t value);
- void print() override;
+ SetStateEvent(double timestamp, container_t container, type_t type, value* val);
+ void print() override;
};
public:
container_t container;
type_t type;
- val_t value;
+ value* val;
int size;
const char* filename;
int linenumber;
void* extra_;
public:
- PushStateEvent (double timestamp, container_t container, type_t type, val_t value);
- PushStateEvent (double timestamp, container_t container, type_t type, val_t value,
- void* extra);
- void print() override;
+ PushStateEvent(double timestamp, container_t container, type_t type, value* val);
+ PushStateEvent(double timestamp, container_t container, type_t type, value* val, void* extra);
+ void print() override;
};
class PopStateEvent : public PajeEvent {
public:
container_t container;
type_t type;
- val_t value;
- public:
- NewEvent (double timestamp, container_t container, type_t type, val_t value);
+ value* val;
+
+public:
+ NewEvent(double timestamp, container_t container, type_t type, value* val);
void print() override;
};
void LogVariableTypeDefinition(type_t type);
void LogStateTypeDefinition(type_t type);
void LogLinkTypeDefinition(type_t type, type_t source, type_t dest);
-void LogEntityValue (val_t value);
+void LogEntityValue(value* val);
void LogContainerCreation (container_t container);
void LogContainerDestruction (container_t container);
void LogDefineEventType(type_t type);
container_t process_container = PJ_container_get (instr_process_id(process, str, len));
type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- val_t value = s_val::PJ_value_get ("suspend", type);
- new PushStateEvent (MSG_get_clock(), process_container, type, value);
+ value* val = value::get("suspend", type);
+ new PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
container_t process_container = PJ_container_get (instr_process_id(process, str, len));
type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- val_t value = s_val::PJ_value_get ("sleep", type);
- new PushStateEvent (MSG_get_clock(), process_container, type, value);
+ value* val = value::get("sleep", type);
+ new PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- val_t value = s_val::PJ_value_get ("task_execute", type);
- new PushStateEvent (MSG_get_clock(), process_container, type, value);
+ value* val = value::get("task_execute", type);
+ new PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- val_t value = s_val::PJ_value_get ("receive", type);
- new PushStateEvent (MSG_get_clock(), process_container, type, value);
+ value* val = value::get("receive", type);
+ new PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- val_t value = s_val::PJ_value_get ("send", type);
- new PushStateEvent (MSG_get_clock(), process_container, type, value);
+ value* val = value::get("send", type);
+ new PushStateEvent(MSG_get_clock(), process_container, type, val);
char key[INSTR_DEFAULT_STR_SIZE];
snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
if (TRACE_msg_vm_is_enabled()) {
container_t vm_container = PJ_container_get(vm->getCname());
type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
- val_t value = s_val::PJ_value_get_or_new("start", "0 0 1", type); // start is blue
- new PushStateEvent(MSG_get_clock(), vm_container, type, value);
+ value* val = value::get_or_new("start", "0 0 1", type); // start is blue
+ new PushStateEvent(MSG_get_clock(), vm_container, type, val);
}
}
if (TRACE_msg_vm_is_enabled()) {
container_t vm_container = PJ_container_get(vm->getCname());
type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
- val_t value = s_val::PJ_value_get_or_new("suspend", "1 0 0", type); // suspend is red
- new PushStateEvent(MSG_get_clock(), vm_container, type, value);
+ value* val = value::get_or_new("suspend", "1 0 0", type); // suspend is red
+ new PushStateEvent(MSG_get_clock(), vm_container, type, val);
}
}
} \
char cont_name[25]; \
snprintf(cont_name, 25, "rank-%d", smpi_process()->index()); \
- val_t value = s_val::PJ_value_get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \
- new NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, value); \
+ value* val = value::get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \
+ new NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, val); \
}
#define AUTOMATIC_COLL_BENCH(cat, ret, args, args2) \
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
const char *color = instr_find_color (operation);
- val_t value = s_val::PJ_value_get_or_new (operation, color, type);
- new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
+ value* val = value::get_or_new(operation, color, type);
+ new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_collective_out(int rank, const char *operation)
container_t container = PJ_container_get(str);
type_t type = PJ_type_get("MPI_STATE", container->type);
const char* color = instr_find_color("computing");
- val_t value = s_val::PJ_value_get_or_new("computing", color, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, value);
+ new PushStateEvent(SIMIX_get_clock(), container, type, value::get_or_new("computing", color, type));
}
void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
- val_t value = s_val::PJ_value_get_or_new ("computing", nullptr, type);
- new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
+ value* val = value::get_or_new("computing", nullptr, type);
+ new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_computing_out(int rank)
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
const char *color = instr_find_color ("sleeping");
- val_t value = s_val::PJ_value_get_or_new ("sleeping", color, type);
- new PushStateEvent (SIMIX_get_clock(), container, type, value);
+ value* val = value::get_or_new("sleeping", color, type);
+ new PushStateEvent(SIMIX_get_clock(), container, type, val);
}
void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
- val_t value = s_val::PJ_value_get_or_new ("sleeping", nullptr, type);
- new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
+ value* val = value::get_or_new("sleeping", nullptr, type);
+ new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_sleeping_out(int rank)
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
- val_t value = s_val::PJ_value_get_or_new ("test", nullptr, type);
- new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
+ value* val = value::get_or_new("test", nullptr, type);
+ new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_testing_out(int rank)
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
const char *color = instr_find_color (operation);
- val_t value = s_val::PJ_value_get_or_new (operation, color, type);
- new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
+ value* val = value::get_or_new(operation, color, type);
+ new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_ptp_out(int rank, int dst, const char *operation)
if (msg_process == nullptr){
msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
- s_val PJ_value("suspend", "1 0 1", state);
- s_val::PJ_value_get_or_new("sleep", "1 1 0", state);
- s_val::PJ_value_get_or_new("receive", "1 0 0", state);
- s_val::PJ_value_get_or_new("send", "0 0 1", state);
- s_val::PJ_value_get_or_new("task_execute", "0 1 1", state);
+ value PJ_value("suspend", "1 0 1", state);
+ value::get_or_new("sleep", "1 1 0", state);
+ value::get_or_new("receive", "1 0 0", state);
+ value::get_or_new("send", "0 0 1", state);
+ value::get_or_new("task_execute", "0 1 1", state);
PJ_type_link_new ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process);
PJ_type_link_new ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process);
}
if (msg_vm == nullptr){
msg_vm = PJ_type_container_new("MSG_VM", container->type);
type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
- s_val PJ_value("suspend", "1 0 1", state);
- s_val::PJ_value_get_or_new ("sleep", "1 1 0", state);
- s_val::PJ_value_get_or_new ("receive", "1 0 0", state);
- s_val::PJ_value_get_or_new ("send", "0 0 1", state);
- s_val::PJ_value_get_or_new ("task_execute", "0 1 1", state);
+ value PJ_value("suspend", "1 0 1", state);
+ value::get_or_new("sleep", "1 1 0", state);
+ value::get_or_new("receive", "1 0 0", state);
+ value::get_or_new("send", "0 0 1", state);
+ value::get_or_new("task_execute", "0 1 1", state);
PJ_type_link_new ("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm);
PJ_type_link_new ("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm);
}
recursiveNewUserStateType (father_type, new_typename, PJ_type_get_root());
}
-static void recursiveNewValueForUserStateType (const char *type_name, const char *value, const char *color, type_t root)
+static void recursiveNewValueForUserStateType(const char* type_name, const char* val, const char* color, type_t root)
{
if (not strcmp(root->name, type_name)) {
- s_val PJ_value (value, color, root);
+ value PJ_value(val, color, root);
}
xbt_dict_cursor_t cursor = nullptr;
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
- recursiveNewValueForUserStateType (type_name, value, color, child_type);
+ recursiveNewValueForUserStateType(type_name, val, color, child_type);
}
}