namespace simgrid {
namespace instr {
+PajeEvent::~PajeEvent()
+{
+ XBT_DEBUG("%s not implemented for %p: event_type=%u, timestamp=%f", __FUNCTION__, this, eventType_, timestamp_);
+}
+
+LinkEvent::LinkEvent(double timestamp, container_t container, Type* type, e_event_type event_type, container_t endpoint,
+ std::string value, std::string key)
+ : LinkEvent(timestamp, container, type, event_type, endpoint, value, key, -1)
+{
+}
+
+LinkEvent::LinkEvent(double timestamp, container_t container, Type* type, e_event_type event_type, container_t endpoint,
+ std::string value, std::string key, int size)
+ : PajeEvent(container, type, timestamp, event_type), endpoint_(endpoint), value_(value), key_(key), size_(size)
+{
+ XBT_DEBUG("%s: event_type=%u, timestamp=%f, value:%s", __FUNCTION__, eventType_, timestamp_, value_.c_str());
+ insertIntoBuffer();
+}
+
VariableEvent::VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
: PajeEvent::PajeEvent(container, type, timestamp, event_type), value(value)
{
insertIntoBuffer();
};
+void LinkEvent::print()
+{
+ std::stringstream stream;
+ stream << std::fixed << std::setprecision(TRACE_precision());
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
+ if (instr_fmt_type != instr_fmt_paje)
+ return;
+ if (timestamp_ < 1e-12)
+ stream << eventType_ << " " << 0 << " " << type->getId() << " " << container->getId() << " " << value_;
+ else
+ stream << eventType_ << " " << timestamp_ << " " << type->getId() << " " << container->getId() << " " << value_;
+
+ stream << " " << endpoint_->getId() << " " << key_;
+
+ if (TRACE_display_sizes()) {
+ stream << " " << size_;
+ }
+ XBT_DEBUG("Dump %s", stream.str().c_str());
+ fprintf(tracing_file, "%s\n", stream.str().c_str());
+}
+
void VariableEvent::print()
{
std::stringstream stream;
--- /dev/null
+/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef INSTR_PAJE_EVENTS_HPP
+#define INSTR_PAJE_EVENTS_HPP
+
+#include "src/instr/instr_private.hpp"
+#include <string>
+
+namespace simgrid {
+namespace instr {
+class EntityValue;
+
+enum e_event_type : unsigned int {
+ PAJE_DefineContainerType,
+ PAJE_DefineVariableType,
+ PAJE_DefineStateType,
+ PAJE_DefineEventType,
+ PAJE_DefineLinkType,
+ PAJE_DefineEntityValue,
+ PAJE_CreateContainer,
+ PAJE_DestroyContainer,
+ PAJE_SetVariable,
+ PAJE_AddVariable,
+ PAJE_SubVariable,
+ PAJE_SetState,
+ PAJE_PushState,
+ PAJE_PopState,
+ PAJE_ResetState,
+ PAJE_StartLink,
+ PAJE_EndLink,
+ PAJE_NewEvent
+};
+
+class PajeEvent {
+protected:
+ Container* container;
+ Type* type;
+
+public:
+ double timestamp_;
+ e_event_type eventType_;
+ PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
+ : container(container), type(type), timestamp_(timestamp), eventType_(eventType){};
+ virtual ~PajeEvent();
+ virtual void print() = 0;
+ void insertIntoBuffer();
+};
+
+class VariableEvent : public PajeEvent {
+ double value;
+
+public:
+ VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value);
+ void print() override;
+};
+
+class StateEvent : public PajeEvent {
+ EntityValue* value;
+ std::string filename;
+ int linenumber;
+ void* extra_ = nullptr;
+
+public:
+ StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value);
+ StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value,
+ void* extra);
+ void print() override;
+};
+
+class LinkEvent : public PajeEvent {
+ Container* endpoint_;
+ std::string value_;
+ std::string key_;
+ int size_ = -1;
+
+public:
+ LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
+ std::string value, std::string key);
+ LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
+ std::string value, std::string key, int size);
+ void print() override;
+};
+
+class NewEvent : public PajeEvent {
+ EntityValue* val;
+
+public:
+ NewEvent(double timestamp, Container* container, Type* type, EntityValue* val);
+ void print() override;
+};
+}
+}
+
+#endif
buffer_debug(&buffer);
}
-simgrid::instr::PajeEvent::~PajeEvent()
-{
- XBT_DEBUG("%s not implemented for %p: event_type=%u, timestamp=%f", __FUNCTION__, this, eventType_, timestamp_);
-}
-
void TRACE_paje_start() {
char *filename = TRACE_get_filename();
tracing_file = fopen(filename, "w");
XBT_DEBUG("Filename %s is closed", filename);
}
-simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type,
- container_t sourceContainer, std::string value, std::string key)
- : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
-{}
-
-simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type,
- container_t sourceContainer, std::string value, std::string key,
- int size)
- : simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_StartLink)
- , sourceContainer_(sourceContainer)
- , value_(value)
- , key_(key)
- , size_(size)
-{
- XBT_DEBUG("%s: event_type=%u, timestamp=%f, value:%s", __FUNCTION__, eventType_, this->timestamp_,
- this->value_.c_str());
- insertIntoBuffer();
-}
-
-void simgrid::instr::StartLinkEvent::print()
-{
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << eventType_;
- print_timestamp(this);
- stream << " " << type->getId() << " " << container->getId() << " " << value_;
- stream << " " << sourceContainer_->getId() << " " << key_;
-
- if (TRACE_display_sizes()) {
- stream << " " << size_;
- }
- print_row();
- } else if (instr_fmt_type == instr_fmt_TI) {
- /* Nothing to do */
- } else {
- THROW_IMPOSSIBLE;
- }
-}
-
-simgrid::instr::EndLinkEvent::EndLinkEvent(double timestamp, container_t container, Type* type,
- container_t destContainer, std::string value, std::string key)
- : simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_EndLink)
- , destContainer(destContainer)
- , value(value)
- , key(key)
-{
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, eventType_, this->timestamp_);
- insertIntoBuffer();
-}
-
-void simgrid::instr::EndLinkEvent::print()
-{
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << eventType_;
- print_timestamp(this);
- stream << " " << type->getId() << " " << container->getId() << " " << value;
- stream << " " << destContainer->getId() << " " << key;
- print_row();
- } else if (instr_fmt_type == instr_fmt_TI) {
- /* Nothing to do */
- } else {
- THROW_IMPOSSIBLE;
- }
-}
-
simgrid::instr::NewEvent::NewEvent(double timestamp, container_t container, Type* type, EntityValue* val)
: simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), val(val)
{
void TRACE_TI_end()
{
fclose(tracing_file);
- char *filename = TRACE_get_filename();
- XBT_DEBUG("Filename %s is closed", filename);
+ XBT_DEBUG("Filename %s is closed", TRACE_get_filename());
}
LinkType::LinkType(std::string name, std::string alias, Type* father) : ValueType(name, alias, father)
{
}
+void LinkType::startEvent(double timestamp, Container* container, container_t endpoint, std::string value,
+ std::string key)
+{
+ startEvent(timestamp, container, endpoint, value, key, -1);
+}
+
+void LinkType::startEvent(double timestamp, Container* container, container_t endpoint, std::string value,
+ std::string key, int size)
+{
+ new LinkEvent(timestamp, container, this, PAJE_StartLink, endpoint, value, key, size);
+}
+
+void LinkType::endEvent(double timestamp, Container* container, container_t endpoint, std::string value,
+ std::string key)
+{
+ new LinkEvent(timestamp, container, this, PAJE_EndLink, endpoint, value, key);
+}
void Type::logDefinition(e_event_type event_type)
{
class LinkType : public ValueType {
public:
LinkType(std::string name, std::string alias, Type* father);
+ void startEvent(double timestamp, Container* source_container, Container* sourceContainer, std::string value,
+ std::string key);
+ void startEvent(double timestamp, Container* source_container, Container* sourceContainer, std::string value,
+ std::string key, int size);
+ void endEvent(double timestamp, Container* source_container, Container* destContainer, std::string value,
+ std::string key);
};
class EventType : public ValueType {
--- /dev/null
+/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef INSTR_PAJE_VALUES_HPP
+#define INSTR_PAJE_VALUES_HPP
+
+#include "src/instr/instr_private.hpp"
+#include <string>
+
+namespace simgrid {
+namespace instr {
+
+class EntityValue {
+ long long int id_;
+ std::string name_;
+ std::string color_;
+ Type* father_;
+
+public:
+ explicit EntityValue(std::string name, std::string color, Type* father);
+ ~EntityValue() = default;
+ const char* getCname() { return name_.c_str(); }
+ long long int getId() { return id_; }
+ void print();
+};
+}
+}
+
+#endif
#include "simgrid/instr.h"
#include "simgrid_config.h"
#include "src/instr/instr_paje_containers.hpp"
+#include "src/instr/instr_paje_events.hpp"
#include "src/instr/instr_paje_types.hpp"
+#include "src/instr/instr_paje_values.hpp"
#include "src/internal_config.h"
#include "xbt/graph.h"
#include <iomanip> /** std::setprecision **/
#define drand48() (rand() / (RAND_MAX + 1.0))
#endif
-namespace simgrid {
-namespace instr {
-
-class Container;
-class Type;
-class EntityValue;
-class ContainerType;
-class EventType;
-class LinkType;
-class StateType;
-class VariableType;
-
-enum e_event_type : unsigned int {
- PAJE_DefineContainerType,
- PAJE_DefineVariableType,
- PAJE_DefineStateType,
- PAJE_DefineEventType,
- PAJE_DefineLinkType,
- PAJE_DefineEntityValue,
- PAJE_CreateContainer,
- PAJE_DestroyContainer,
- PAJE_SetVariable,
- PAJE_AddVariable,
- PAJE_SubVariable,
- PAJE_SetState,
- PAJE_PushState,
- PAJE_PopState,
- PAJE_ResetState,
- PAJE_StartLink,
- PAJE_EndLink,
- PAJE_NewEvent
-};
-
-class EntityValue {
- long long int id_;
- std::string name_;
- std::string color_;
- Type* father_;
-
-public:
- explicit EntityValue(std::string name, std::string color, Type* father);
- ~EntityValue() = default;
- const char* getCname() { return name_.c_str(); }
- long long int getId() { return id_; }
- void print();
-};
-
-class PajeEvent {
-protected:
- Container* container;
- Type* type;
-
-public:
- double timestamp_;
- e_event_type eventType_;
- PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
- : container(container), type(type), timestamp_(timestamp), eventType_(eventType){};
- virtual ~PajeEvent();
- virtual void print() = 0;
- void insertIntoBuffer();
-};
-
-class VariableEvent : public PajeEvent {
- double value;
-
-public:
- VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value);
- void print() override;
-};
-
-class StateEvent : public PajeEvent {
- EntityValue* value;
- std::string filename;
- int linenumber;
- void* extra_ = nullptr;
-
-public:
- StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value);
- StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value,
- void* extra);
- void print() override;
-};
-
-class StartLinkEvent : public PajeEvent {
- Container* sourceContainer_;
- std::string value_;
- std::string key_;
- int size_;
-
-public:
- StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, std::string value,
- std::string key);
- StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, std::string value,
- std::string key, int size);
- void print() override;
-};
-
-class EndLinkEvent : public PajeEvent {
- Container* destContainer;
- std::string value;
- std::string key;
-
-public:
- EndLinkEvent(double timestamp, Container* container, Type* type, Container* destContainer, std::string value,
- std::string key);
- ~EndLinkEvent() = default;
- void print() override;
-};
-
-class NewEvent : public PajeEvent {
- EntityValue* val;
-
-public:
- NewEvent(double timestamp, Container* container, Type* type, EntityValue* val);
- void print() override;
-};
-}
-} // namespace simgrid::instr
typedef simgrid::instr::Container* container_t;
extern "C" {
//start link
container_t msg = simgrid::instr::Container::byName(instr_process_id(process));
- simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_LINK");
- new simgrid::instr::StartLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type, msg, "M",
- key);
+ simgrid::instr::LinkType* link =
+ static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_LINK"));
+ link->startEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), msg, "M", key);
//destroy existing container of this process
TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process));
//end link
msg = simgrid::instr::Container::byName(instr_process_id(process));
- type = simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_LINK");
- new simgrid::instr::EndLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type, msg, "M",
- key);
+ link->endEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), msg, "M", key);
}
}
state->popEvent(MSG_get_clock(), process_container);
std::string key = std::string("p") + std::to_string(task->counter);
- simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_TASK_LINK");
- new simgrid::instr::EndLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type,
- process_container, "SR", key);
+ simgrid::instr::LinkType* link =
+ static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_TASK_LINK"));
+ link->endEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), process_container, "SR", key);
}
}
state->pushEvent(MSG_get_clock(), process_container, "send");
std::string key = std::string("p") + std::to_string(task->counter);
- simgrid::instr::LinkType* type =
+ simgrid::instr::LinkType* link =
static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_TASK_LINK"));
- new simgrid::instr::StartLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type,
- process_container, "SR", key);
+ link->startEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), process_container, "SR", key);
}
return 1;
// start link
container_t msg = simgrid::instr::Container::byName(vm->getName());
- simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName("MSG_VM_LINK");
- new simgrid::instr::StartLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type, msg, "M",
- key);
+ simgrid::instr::LinkType* link =
+ static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MSG_VM_LINK"));
+ link->startEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), msg, "M", key);
// destroy existing container of this vm
container_t existing_container = simgrid::instr::Container::byName(vm->getName());
// end link
msg = simgrid::instr::Container::byName(vm->getName());
- type = simgrid::instr::Type::getRootType()->byName("MSG_VM_LINK");
- new simgrid::instr::EndLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type, msg, "M",
- key);
+ link->endEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), msg, "M", key);
}
// Inform the SRC that the migration has been correctly performed
std::string key = TRACE_smpi_get_key(src, dst, tag, 1);
container_t container = simgrid::instr::Container::byName(smpi_container(rank));
- simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName("MPI_LINK");
+ simgrid::instr::LinkType* link =
+ static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MPI_LINK"));
XBT_DEBUG("Send tracing from %d to %d, tag %d, with key %s", src, dst, tag, key.c_str());
- new simgrid::instr::StartLinkEvent(SIMIX_get_clock(), simgrid::instr::Container::getRootContainer(), type, container,
- "PTP", key, size);
+ link->startEvent(SIMIX_get_clock(), simgrid::instr::Container::getRootContainer(), container, "PTP", key, size);
}
void TRACE_smpi_recv(int src, int dst, int tag)
std::string key = TRACE_smpi_get_key(src, dst, tag, 0);
container_t container = simgrid::instr::Container::byName(smpi_container(dst));
- simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName("MPI_LINK");
+ simgrid::instr::LinkType* link =
+ static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MPI_LINK"));
XBT_DEBUG("Recv tracing from %d to %d, tag %d, with key %s", src, dst, tag, key.c_str());
- new simgrid::instr::EndLinkEvent(SIMIX_get_clock(), simgrid::instr::Container::getRootContainer(), type, container,
- "PTP", key);
+ link->endEvent(SIMIX_get_clock(), simgrid::instr::Container::getRootContainer(), container, "PTP", key);
}
std::string link_typename = father->type_->getName() + "-" + src->type_->getName() +
std::to_string(src->type_->getId()) + "-" + dst->type_->getName() +
std::to_string(dst->type_->getId());
- simgrid::instr::Type* link_type = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_);
+ simgrid::instr::LinkType* link = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_);
//register EDGE types for triva configuration
- trivaEdgeTypes.insert(link_type->getName());
+ trivaEdgeTypes.insert(link->getName());
//create the link
static long long counter = 0;
std::string key = std::to_string(counter);
counter++;
- new simgrid::instr::StartLinkEvent(SIMIX_get_clock(), father, link_type, src, "topology", key);
- new simgrid::instr::EndLinkEvent(SIMIX_get_clock(), father, link_type, dst, "topology", key);
+ link->startEvent(SIMIX_get_clock(), father, src, "topology", key);
+ link->endEvent(SIMIX_get_clock(), father, dst, "topology", key);
XBT_DEBUG(" linkContainers %s <-> %s", src->getCname(), dst->getCname());
}
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_containers.hpp
src/instr/instr_paje_events.cpp
+ src/instr/instr_paje_events.hpp
src/instr/instr_paje_header.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_types.hpp
src/instr/instr_paje_values.cpp
+ src/instr/instr_paje_values.hpp
src/instr/instr_private.hpp
src/instr/instr_smpi.hpp
src/instr/instr_resource_utilization.cpp