* \see TRACE_mark
*/
void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mark_value, const char *mark_color)
-{
+{ paje_value pj_value;
/* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
if (not TRACE_is_enabled() || not TRACE_needs_platform())
return;
mark_color = white;
XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
- PJ_value_new (mark_value, mark_color, type);
+ pj_value.PJ_value_new (mark_value, mark_color, type);
}
/** \ingroup TRACE_mark
* \see TRACE_declare_mark
*/
void TRACE_mark(const char *mark_type, const char *mark_value)
-{
+{ paje_value pj_value;
/* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
if (not TRACE_is_enabled() || not TRACE_needs_platform())
return;
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
}
- val_t value = PJ_value_get (mark_value, type);
+ val_t value = pj_value.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);
}
* \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)
-{
+{ paje_value pj_value;
container_t container = PJ_container_get(host);
type_t type = PJ_type_get (state, container->type);
- val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+ val_t val = pj_value.PJ_value_get_or_new (value, 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)
-{
+{ paje_value pj_value;
container_t container = PJ_container_get(host);
type_t type = PJ_type_get (state, container->type);
- val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+ val_t val = pj_value.PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
new PushStateEvent(MSG_get_clock(), container, type, val);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)");
-val_t PJ_value_new (const char *name, const char *color, type_t father)
+val_t paje_value :: PJ_value_new (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)");
return ret;
}
-val_t PJ_value_get_or_new (const char *name, const char *color, type_t father)
-{
+val_t paje_value :: PJ_value_get_or_new (const char *name, const char *color, type_t father)
+{ paje_value pj_value;
val_t ret = 0;
try {
- ret = PJ_value_get(name, father);
+ ret = pj_value.PJ_value_get(name, father);
}
catch(xbt_ex& e) {
- ret = PJ_value_new(name, color, father);
+ ret = pj_value.PJ_value_new(name, color, father);
}
return ret;
}
-val_t PJ_value_get (const char *name, type_t father)
+val_t paje_value::PJ_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)");
};
+class paje_value{
+ public:
+ paje_value(){};
+ ~paje_value(){};
+ val_t PJ_value_new (const char *name, const char *color, type_t father);
+ val_t PJ_value_get (const char *name, type_t father);
+ val_t PJ_value_get_or_new (const char *name, const char *color, type_t father);
+};
extern XBT_PRIVATE xbt_dict_t created_categories;
extern XBT_PRIVATE xbt_dict_t declared_marks;
/* instr_config.c */
XBT_PRIVATE void recursiveDestroyType (type_t type);
-/* instr_paje_values.c */
-XBT_PUBLIC(val_t) PJ_value_new (const char *name, const char *color, type_t father);
-XBT_PUBLIC(val_t) PJ_value_get_or_new (const char *name, const char *color, type_t father);
-XBT_PUBLIC(val_t) PJ_value_get (const char *name, const type_t father);
-
XBT_PRIVATE void TRACE_TI_start();
XBT_PRIVATE void TRACE_TI_end();
}
void TRACE_msg_process_suspend(msg_process_t process)
-{
+{ paje_value pj_value;
if (TRACE_msg_process_is_enabled()){
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
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 = PJ_value_get ("suspend", type);
+ val_t value = pj_value.PJ_value_get ("suspend", type);
new PushStateEvent (MSG_get_clock(), process_container, type, value);
}
}
}
void TRACE_msg_process_sleep_in(msg_process_t process)
-{
+{ paje_value pj_value;
if (TRACE_msg_process_is_enabled()){
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
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 = PJ_value_get ("sleep", type);
+ val_t value = pj_value.PJ_value_get ("sleep", type);
new PushStateEvent (MSG_get_clock(), process_container, type, value);
}
}
/* MSG_task_execute related functions */
void TRACE_msg_task_execute_start(msg_task_t task)
-{
+{ paje_value pj_value;
XBT_DEBUG("EXEC,in %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_process_is_enabled()){
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 = PJ_value_get ("task_execute", type);
+ val_t value = pj_value.PJ_value_get ("task_execute", type);
new PushStateEvent (MSG_get_clock(), process_container, type, value);
}
}
/* MSG_task_get related functions */
void TRACE_msg_task_get_start()
-{
+{ paje_value pj_value;
XBT_DEBUG("GET,in");
if (TRACE_msg_process_is_enabled()){
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 = PJ_value_get ("receive", type);
+ val_t value = pj_value.PJ_value_get ("receive", type);
new PushStateEvent (MSG_get_clock(), process_container, type, value);
}
}
/* MSG_task_put related functions */
int TRACE_msg_task_put_start(msg_task_t task)
-{
+{ paje_value pj_value;
XBT_DEBUG("PUT,in %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_process_is_enabled()){
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 = PJ_value_get ("send", type);
+ val_t value = pj_value.PJ_value_get ("send", type);
new PushStateEvent (MSG_get_clock(), process_container, type, value);
char key[INSTR_DEFAULT_STR_SIZE];
* If the VM cannot be started (because of memory over-provisioning), an exception is generated.
*/
void MSG_vm_start(msg_vm_t vm)
-{
+{ paje_value pj_value;
simgrid::simix::kernelImmediate([vm]() {
simgrid::vm::VmHostExt::ensureVmExtInstalled();
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 = PJ_value_get_or_new("start", "0 0 1", type); // start is blue
+ val_t value = pj_value.PJ_value_get_or_new("start", "0 0 1", type); // start is blue
new PushStateEvent(MSG_get_clock(), vm_container, type, value);
}
}
* No suspension cost occurs.
*/
void MSG_vm_suspend(msg_vm_t vm)
-{
+{ paje_value pj_value;
smx_actor_t issuer = SIMIX_process_self();
simgrid::simix::kernelImmediate([vm, issuer]() { vm->pimpl_vm_->suspend(issuer); });
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 = PJ_value_get_or_new("suspend", "1 0 0", type); // suspend is red
+ val_t value = pj_value.PJ_value_get_or_new("suspend", "1 0 0", type); // suspend is red
new PushStateEvent(MSG_get_clock(), vm_container, type, value);
}
}
//attempt to do a quick autotuning version of the collective,
-
-#define TRACE_AUTO_COLL(cat) \
+paje_value pj_value;
+#define TRACE_AUTO_COLL(cat) \
if (TRACE_is_enabled()) { \
type_t type = PJ_type_get_or_null(#cat, PJ_type_get_root()); \
if (not type) { \
type = PJ_type_event_new(#cat, PJ_type_get_root()); \
} \
char cont_name[25]; \
- snprintf(cont_name, 25, "rank-%d", smpi_process()->index()); \
- val_t value = PJ_value_get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \
+ snprintf(cont_name, 25, "rank-%d", smpi_process()->index()); \
+ val_t value = pj_value.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); \
}
}
void TRACE_smpi_collective_in(int rank, int root, const char *operation, instr_extra_data extra)
-{
+{ paje_value pj_value;
if (not TRACE_smpi_is_enabled()) {
cleanup_extra_data(extra);
return;
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 = PJ_value_get_or_new (operation, color, type);
+ val_t value = pj_value.PJ_value_get_or_new (operation, color, type);
new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
}
void TRACE_smpi_computing_init(int rank)
-{
+{ paje_value pj_value;
//first use, initialize the color in the trace
if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing())
return;
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 = PJ_value_get_or_new("computing", color, type);
+ val_t value = pj_value.PJ_value_get_or_new("computing", color, type);
new PushStateEvent(SIMIX_get_clock(), container, type, value);
}
void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
-{
+{ paje_value pj_value;
//do not forget to set the color first, otherwise this will explode
if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing()) {
cleanup_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 = PJ_value_get_or_new ("computing", nullptr, type);
+ val_t value = pj_value.PJ_value_get_or_new ("computing", nullptr, type);
new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
}
void TRACE_smpi_sleeping_init(int rank)
-{
+{ paje_value pj_value;
//first use, initialize the color in the trace
if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping())
return;
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 = PJ_value_get_or_new ("sleeping", color, type);
+ val_t value = pj_value.PJ_value_get_or_new ("sleeping", color, type);
new PushStateEvent (SIMIX_get_clock(), container, type, value);
}
void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
-{
+{ paje_value pj_value;
//do not forget to set the color first, otherwise this will explode
if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping()) {
cleanup_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 = PJ_value_get_or_new ("sleeping", nullptr, type);
+ val_t value = pj_value.PJ_value_get_or_new ("sleeping", nullptr, type);
new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
}
void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
-{
+{ paje_value pj_value;
//do not forget to set the color first, otherwise this will explode
if (not TRACE_smpi_is_enabled()) {
cleanup_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 = PJ_value_get_or_new ("test", nullptr, type);
+ val_t value = pj_value.PJ_value_get_or_new ("test", nullptr, type);
new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
}
void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation, instr_extra_data extra)
-{
+{ paje_value pj_value;
if (not TRACE_smpi_is_enabled()) {
cleanup_extra_data(extra);
return;
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 = PJ_value_get_or_new (operation, color, type);
+ val_t value = pj_value.PJ_value_get_or_new (operation, color, type);
new PushStateEvent (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
}
static void sg_instr_new_host(simgrid::s4u::Host& host)
-{
+{ paje_value pj_value;
container_t father = currentContainer.back();
container_t container = PJ_container_new(host.getCname(), INSTR_HOST, father);
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);
- PJ_value_new ("suspend", "1 0 1", state);
- PJ_value_new ("sleep", "1 1 0", state);
- PJ_value_new ("receive", "1 0 0", state);
- PJ_value_new ("send", "0 0 1", state);
- PJ_value_new ("task_execute", "0 1 1", state);
+ pj_value.PJ_value_new ("suspend", "1 0 1", state);
+ pj_value.PJ_value_new ("sleep", "1 1 0", state);
+ pj_value.PJ_value_new ("receive", "1 0 0", state);
+ pj_value.PJ_value_new ("send", "0 0 1", state);
+ pj_value.PJ_value_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);
- PJ_value_new ("suspend", "1 0 1", state);
- PJ_value_new ("sleep", "1 1 0", state);
- PJ_value_new ("receive", "1 0 0", state);
- PJ_value_new ("send", "0 0 1", state);
- PJ_value_new ("task_execute", "0 1 1", state);
+ pj_value.PJ_value_new ("suspend", "1 0 1", state);
+ pj_value.PJ_value_new ("sleep", "1 1 0", state);
+ pj_value.PJ_value_new ("receive", "1 0 0", state);
+ pj_value.PJ_value_new ("send", "0 0 1", state);
+ pj_value.PJ_value_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);
}
}
static void recursiveNewValueForUserStateType (const char *type_name, const char *value, const char *color, type_t root)
-{
+{ paje_value pj_value;
if (not strcmp(root->name, type_name)) {
- PJ_value_new (value, color, root);
+ pj_value.PJ_value_new (value, color, root);
}
xbt_dict_cursor_t cursor = nullptr;
type_t child_type;