-
-PajeEvent:: ~PajeEvent()
-{
- XBT_DEBUG("%s not implemented for %p: event_type=%d, timestamp=%f", __FUNCTION__,
- this, (int)event_type, timestamp);
-// xbt_backtrace_display_current();
-
- /* switch (event->event_type){
- case PAJE_StartLink:
- xbt_free (((startLink_t)(event->data))->value);
- xbt_free (((startLink_t)(event->data))->key);
- break;
- case PAJE_EndLink:
- xbt_free (((endLink_t)(event->data))->value);
- xbt_free (((endLink_t)(event->data))->key);
- break;
- default:
- break;
- }*/
-}
-
-void TRACE_paje_start() {
- char *filename = TRACE_get_filename();
- tracing_file = fopen(filename, "w");
- if (tracing_file == nullptr){
- THROWF (system_error, 1, "Tracefile %s could not be opened for writing.", filename);
- }
-
- XBT_DEBUG("Filename %s is open for writing", filename);
-
- /* output generator version */
- fprintf (tracing_file, "#This file was generated using SimGrid-%d.%d.%d\n",
- SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR, SIMGRID_VERSION_PATCH);
- fprintf (tracing_file, "#[");
- unsigned int cpt;
- char *str;
- xbt_dynar_foreach (xbt_cmdline, cpt, str){
- fprintf(tracing_file, "%s ",str);
- }
- fprintf (tracing_file, "]\n");
-
- /* output one line comment */
- dump_comment (TRACE_get_comment());
-
- /* output comment file */
- dump_comment_file (TRACE_get_comment_file());
-
- /* output header */
- TRACE_header(TRACE_basic(),TRACE_display_sizes());
-}
-
-void TRACE_paje_end() {
- fclose(tracing_file);
- char *filename = TRACE_get_filename();
- XBT_DEBUG("Filename %s is closed", filename);
-}
-
-DefineContainerEvent::DefineContainerEvent(type_t type)
-{
-
- event_type = PAJE_DefineContainerType;
- timestamp = 0;
- this->type = type;
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
- //print it
- print ();
-}
-
-void DefineContainerEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- stream << " " << type->id
- << " " << type->father->id
- << " " << type->name;
- print_row();
-}
-
-
-
-DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type)
-{
- this->event_type = PAJE_DefineVariableType;
- this->timestamp = 0;
- this->type = type;
-
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
- //print it
- print ();
-}
-
-void DefineVariableTypeEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- stream << " " << type->id
- << " " << type->father->id
- << " " << type->name;
- if (type->color)
- stream << " \"" << type->color << "\"";
- print_row();
-}
-
-DefineStateTypeEvent::DefineStateTypeEvent(type_t type)
-{
- this->event_type = PAJE_DefineStateType;
- this->timestamp = 0;
- this->type = type;
-
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
- //print it
- print();
-}
-
-
-DefineEventTypeEvent::DefineEventTypeEvent(type_t type)
-{
- this->event_type = PAJE_DefineEventType;
- this->timestamp = 0;
- this->type = type;
-
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
- //print it
- print();
-}
-
-
-void DefineStateTypeEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- stream << " " << type->id
- << " " << type->father->id
- << " " << type->name;
- print_row();
-}
-
-void DefineEventTypeEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- stream << " " << type->id
- << " " << type->father->id
- << " " << type->name;
- print_row();
-}
-
-DefineLinkTypeEvent::DefineLinkTypeEvent(type_t type, type_t source, type_t dest)
-{
- this->event_type = PAJE_DefineLinkType;
- this->timestamp = 0;
- this->type = type;
- this->source = source;
- this->dest = dest;
-
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
- //print it
- print();
-}
-
-void DefineLinkTypeEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- stream << " " << type->id
- << " " << type->father->id
- << " " << source->id
- << " " << dest->id
- << " " << type->name;
- print_row();
-}
-
-DefineEntityValueEvent::DefineEntityValueEvent (val_t value)
-{
- this->event_type = PAJE_DefineEntityValue;
- this->timestamp = 0;
- this->value = value;
-
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
- //print it
- print();
-}
-
-
-void DefineEntityValueEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- stream << " " << value->id
- << " " << value->father->id
- << " " << value->name;
- if(value->color)
- stream << " \"" << value->color << "\"";
- print_row();
-}
-
-CreateContainerEvent::CreateContainerEvent (container_t container)
-{
- this->event_type = PAJE_CreateContainer;
- this->timestamp = SIMIX_get_clock();
- this->container = container;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- //print it
- print();
-}
-
-void CreateContainerEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << container->id
- << " " << container->type->id
- << " " << container->father->id
- << " \"" << container->name << "\"";
-
- print_row();
-}
-
-DestroyContainerEvent::DestroyContainerEvent (container_t container)
-{
- this->event_type = PAJE_DestroyContainer;
- this->timestamp = SIMIX_get_clock();
- this->container = container;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- print();
-}
-
-void DestroyContainerEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << container->type->id
- << " " << container->id;
-
- print_row();
-}
-
-SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
-{
- this->event_type = PAJE_SetVariable;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->value = value;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void SetVariableEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id
- << " " << value;
- print_row();
-}
-
-AddVariableEvent::AddVariableEvent (double timestamp, container_t container, type_t type, double value)
-{
- this->event_type = PAJE_AddVariable;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->value = value;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void AddVariableEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id
- << " " << value;
- print_row();
-}
-
-SubVariableEvent::SubVariableEvent (double timestamp, container_t container, type_t type, double value)
-{
- this->event_type = PAJE_SubVariable;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->value = value;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void SubVariableEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id
- << " " << value;
- print_row();
-}
-
-SetStateEvent::SetStateEvent (double timestamp, container_t container, type_t type, val_t value)
-{
- this->event_type = PAJE_SetState;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->value = value;
-
-#if HAVE_SMPI
- if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
- smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
- filename = loc->filename;
- linenumber = loc->linenumber;
- }
-#endif
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void SetStateEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id;
- stream << " " <<value->id;
-#if HAVE_SMPI
- if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
- stream << " \"" << filename
- << "\" " << linenumber;
- }
-#endif
- print_row();
-}
-
-PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value, void* extra)
-{
- this->event_type = PAJE_PushState;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->value = value;
- this->extra = extra;
-
-#if HAVE_SMPI
- if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
- smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
- filename = loc->filename;
- linenumber = loc->linenumber;
- }
-#endif
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value)
- : PushStateEvent(timestamp, container, type, value, nullptr)
-{}
-void PushStateEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id;
- stream << " " <<value->id;
-
- if (TRACE_display_sizes()) {
- stream << " ";
- if (extra != nullptr) {
- stream << static_cast<instr_extra_data>(extra)->send_size;
- }
- else {
- stream << 0;
- }
- }
-#if HAVE_SMPI
- if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
- stream << " \"" << filename
- << "\" " << linenumber;
- }
-#endif
- print_row();
-
- if (extra != nullptr) {
- if (static_cast<instr_extra_data>(extra)->sendcounts != nullptr)
- xbt_free(static_cast<instr_extra_data>(extra)->sendcounts);
- if (static_cast<instr_extra_data>(extra)->recvcounts != nullptr)
- xbt_free(static_cast<instr_extra_data>(extra)->recvcounts);
- xbt_free(extra);
- }
-}
-
-
-PopStateEvent::PopStateEvent (double timestamp, container_t container, type_t type)
-{
- this->event_type = PAJE_PopState;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void PopStateEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id;
- print_row();
-}
-
-ResetStateEvent::ResetStateEvent (double timestamp, container_t container, type_t type)
-{
- this->event_type = PAJE_ResetState;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void ResetStateEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id;
- print_row();
-}
-
-StartLinkEvent::StartLinkEvent (double timestamp, container_t container,
- type_t type, container_t sourceContainer, const char *value, const char *key)
- : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
-{}
-
-StartLinkEvent::StartLinkEvent (double timestamp, container_t container, type_t type, container_t sourceContainer,
- const char *value, const char *key, int size)
-{
- event_type = PAJE_StartLink;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->sourceContainer = sourceContainer;
- this->value = xbt_strdup(value);
- this->key = xbt_strdup(key);
- this->size = size;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__,
- (int)event_type, this->timestamp, this->value);
-
- insert_into_buffer (this);
-}
-
-void StartLinkEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " <<type->id
- << " " <<container->id
- << " " <<value;
- stream << " " << sourceContainer->id
- << " " << key;
-
- if (TRACE_display_sizes()) {
- stream << " " << size;
- }
- print_row();
-}
-
-EndLinkEvent::EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
- const char *value, const char *key)
-{
- this->event_type = PAJE_EndLink;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->destContainer = destContainer;
- this->value = xbt_strdup(value);
- this->key = xbt_strdup(key);
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-
-void EndLinkEvent::print() {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " <<type->id
- << " " <<container->id
- << " " <<value;
- stream << " " << destContainer->id
- << " " << key;
- print_row();
-}
-
-NewEvent::NewEvent (double timestamp, container_t container, type_t type, val_t value)
-{
- this->event_type = PAJE_NewEvent;
- this->timestamp = timestamp;
- this->type = type;
- this->container = container;
- this->value = value;
-
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
- insert_into_buffer (this);
-}
-
-void NewEvent::print () {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << type->id
- << " " << container->id
- << " " << value->id;
- print_row();
-}