X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c1b3e440de2150420b08c0bc55a125a0c9eb86bc..6fb292d7e99020dc305b845e0a2284a9d811a4b2:/src/instr/instr_paje_events.hpp diff --git a/src/instr/instr_paje_events.hpp b/src/instr/instr_paje_events.hpp index 2590273400..293a2cd0e9 100644 --- a/src/instr/instr_paje_events.hpp +++ b/src/instr/instr_paje_events.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2020. 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. */ @@ -40,16 +40,21 @@ enum e_event_type : unsigned int { class PajeEvent { Container* container_; Type* type_; -protected: - Container* get_container() { return container_; } public: + static xbt::signal on_creation; + static xbt::signal on_destruction; + double timestamp_; e_event_type eventType_; std::stringstream stream_; PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType); - virtual ~PajeEvent() = default; - virtual void print(); + virtual ~PajeEvent(); + + Container* get_container() const { return container_; } + Type* get_type() const { return type_; } + + virtual void print() = 0; void insert_into_buffer(); }; @@ -61,7 +66,7 @@ public: : PajeEvent::PajeEvent(container, type, timestamp, event_type), value_(value) { } - void print() override; + void print() override { stream_ << " " << value_; } }; class StateEvent : public PajeEvent { @@ -70,10 +75,13 @@ class StateEvent : public PajeEvent { std::string filename = "(null)"; int linenumber = -1; #endif - TIData* extra_; + std::unique_ptr extra_; public: + static xbt::signal on_destruction; StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra); + ~StateEvent() override { on_destruction(*this); } + bool has_extra() const { return extra_ != nullptr; } void print() override; }; @@ -84,11 +92,11 @@ class LinkEvent : public PajeEvent { int size_ = -1; public: - LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value, - std::string key, int size) + LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, + const std::string& value, const std::string& key, int size) : PajeEvent(container, type, SIMIX_get_clock(), event_type) , endpoint_(sourceContainer) - , value_(std::move(value)) + , value_(value) , key_(key) , size_(size) { @@ -101,11 +109,11 @@ class NewEvent : public PajeEvent { public: NewEvent(double timestamp, Container* container, Type* type, EntityValue* value) - : simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), value(value) + : PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), value(value) { } void print() override; }; -} -} +} // namespace instr +} // namespace simgrid #endif