-#define INSTR_DEFAULT_STR_SIZE 500
-
-#include "xbt/graph.h"
-#include "xbt/dict.h"
-
-namespace simgrid {
-namespace instr {
-typedef enum {
- 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
-} e_event_type;
-
-typedef enum {
- TYPE_VARIABLE,
- TYPE_LINK,
- TYPE_CONTAINER,
- TYPE_STATE,
- TYPE_EVENT
-} e_entity_types;
-
-//--------------------------------------------------
-
-class Type {
-public:
- char* id_;
- char* name_;
- char* color_;
-
- e_entity_types kind_;
- Type* father_;
- xbt_dict_t children_;
- xbt_dict_t values_; // valid for all types except variable and container
- Type(const char* typeNameBuff, const char* key, const char* color, e_entity_types kind, Type* father);
- ~Type();
- Type* getChild(const char* name);
- Type* getChildOrNull(const char* name);
-
- static Type* containerNew(const char* name, Type* father);
- static Type* eventNew(const char* name, Type* father);
- static Type* variableNew(const char* name, const char* color, Type* father);
- static Type* linkNew(const char* name, Type* father, Type* source, Type* dest);
- static Type* stateNew(const char* name, Type* father);
-};
-
-//--------------------------------------------------
-class Value {
-public:
- char* id_;
- char* name_;
- char* color_;
-
- Type* father_;
- Value(const char* name, const char* color, Type* father);
- ~Value();
- static Value* get_or_new(const char* name, const char* color, Type* father);
- static Value* get(const char* name, Type* father);
-};
-
-//--------------------------------------------------
-typedef enum {
- INSTR_HOST,
- INSTR_LINK,
- INSTR_ROUTER,
- INSTR_AS,
- INSTR_SMPI,
- INSTR_MSG_VM,
- INSTR_MSG_PROCESS,
- INSTR_MSG_TASK
-} e_container_types;
-
-//--------------------------------------------------
-
-class Container {
-public:
- Container(std::string name, simgrid::instr::e_container_types kind, Container* father);
- virtual ~Container();
-
- sg_netpoint_t netpoint_;
- std::string name_; /* Unique name of this container */
- std::string id_; /* Unique id of this container */
- Type* type_; /* Type of this container */
- int level_ = 0; /* Level in the hierarchy, root level is 0 */
- e_container_types kind_; /* This container is of what kind */
- Container* father_;
- std::map<std::string, Container*> children_;
-};
-
-//--------------------------------------------------
-class PajeEvent {
- public:
- double timestamp_;
- e_event_type eventType_;
- virtual void print() = 0;
- virtual ~PajeEvent();
-};
-
-//--------------------------------------------------
-class SetVariableEvent : public PajeEvent {
- private:
- Container* container;
- Type* type;
- double value;
-
- public:
- SetVariableEvent(double timestamp, Container* container, Type* type, double value);
- void print() override;
-};
-
-class AddVariableEvent:public PajeEvent {
- private:
- Container* container;
- Type* type;
- double value;
-
- public:
- AddVariableEvent(double timestamp, Container* container, Type* type, double value);
- void print() override;
-};
-//--------------------------------------------------
-
-
-class SubVariableEvent : public PajeEvent {
- private:
- Container* container;
- Type* type;
- double value;
- public:
- SubVariableEvent(double timestamp, Container* container, Type* type, double value);
- void print() override;
-};
-//--------------------------------------------------
-
-class SetStateEvent : public PajeEvent {
- private:
- Container* container;
- Type* type;
- Value* value;
- const char* filename;
- int linenumber;
-
- public:
- SetStateEvent(double timestamp, Container* container, Type* type, Value* val);
- void print() override;
-};
-
-
-class PushStateEvent : public PajeEvent {
- public:
- Container* container;
- Type* type;
- Value* value;
- int size;
- const char* filename;
- int linenumber;
- void* extra_;
-
- public:
- PushStateEvent(double timestamp, Container* container, Type* type, Value* val);
- PushStateEvent(double timestamp, Container* container, Type* type, Value* val, void* extra);
- void print() override;
-};
-
-class PopStateEvent : public PajeEvent {
- Container* container;
- Type* type;
-
-public:
- PopStateEvent(double timestamp, Container* container, Type* type);
- void print() override;
-};
-
-class ResetStateEvent : public PajeEvent {
- Container* container;
- Type* type;
-
-public:
- ResetStateEvent(double timestamp, Container* container, Type* type);
- void print() override;
-};
-
-class StartLinkEvent : public PajeEvent {
- Container* container_;
- Type* type_;
- Container* sourceContainer_;
- std::string value_;
- std::string key_;
- int size_;
-
-public:
- StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, const char* value,
- const char* key);
- StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, const char* value,
- const char* key, int size);
- void print() override;
-};
-
-class EndLinkEvent : public PajeEvent {
- Container* container;
- Type* type;
- 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 {
- public:
- Container* container;
- Type* type;
- Value* val;
-
- public:
- NewEvent(double timestamp, Container* container, Type* type, Value* val);
- void print() override;
-};
-}
-} // namespace simgrid::instr