A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
[sonar] Fix more implicit casts that should not lower precision (S5276).
[simgrid.git]
/
src
/
instr
/
instr_config.cpp
diff --git
a/src/instr/instr_config.cpp
b/src/instr/instr_config.cpp
index
f80a379
..
f1c9d17
100644
(file)
--- a/
src/instr/instr_config.cpp
+++ b/
src/instr/instr_config.cpp
@@
-172,7
+172,7
@@
static void print_line(const char* option, const char* desc, const char* longdes
{
std::string str = std::string("--cfg=") + option + " ";
- int len = st
r.size(
);
+ int len = st
atic_cast<int>(str.size()
);
XBT_HELP("%s%*.*s %s", str.c_str(), 30 - len, 30 - len, "", desc);
if (longdesc != nullptr) {
XBT_HELP("%s\n", longdesc);
@@
-218,11
+218,14
@@
int trace_precision;
*************/
xbt::signal<void(Container&)> Container::on_creation;
xbt::signal<void(Container&)> Container::on_destruction;
-xbt::signal<void(EntityValue&)> EntityValue::on_creation;
xbt::signal<void(Type&, e_event_type)> Type::on_creation;
xbt::signal<void(LinkType&, Type&, Type&)> LinkType::on_creation;
+xbt::signal<void(PajeEvent&)> PajeEvent::on_creation;
+xbt::signal<void(PajeEvent&)> PajeEvent::on_destruction;
+xbt::signal<void(StateEvent&)> StateEvent::on_destruction;
+xbt::signal<void(EntityValue&)> EntityValue::on_creation;
-static void on_container_creation_paje(Container& c)
+static void on_container_creation_paje(
const
Container& c)
{
double timestamp = SIMIX_get_clock();
std::stringstream stream;
@@
-241,12
+244,8
@@
static void on_container_creation_paje(Container& c)
tracing_file << stream.str() << std::endl;
}
-static void on_container_destruction_paje(Container& c)
+static void on_container_destruction_paje(
const
Container& c)
{
- // obligation to dump previous events because they might reference the container that is about to be destroyed
- last_timestamp_to_dump = SIMIX_get_clock();
- dump_buffer(true);
-
// trace my destruction, but not if user requests so or if the container is root
if (not trace_disable_destroy && &c != Container::get_root()) {
std::stringstream stream;
@@
-289,12
+288,7
@@
static void on_container_creation_ti(Container& c)
static void on_container_destruction_ti(Container& c)
{
- // obligation to dump previous events because they might reference the container that is about to be destroyed
- last_timestamp_to_dump = SIMIX_get_clock();
- dump_buffer(true);
-
if (not trace_disable_destroy && &c != Container::get_root()) {
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_DestroyContainer, SIMIX_get_clock());
if (not simgrid::config::get_value<bool>("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) {
tracing_files.at(&c)->close();
delete tracing_files.at(&c);
@@
-303,7
+297,7
@@
static void on_container_destruction_ti(Container& c)
}
}
-static void on_entity_value_creation(EntityValue& value)
+static void on_entity_value_creation(
const
EntityValue& value)
{
std::stringstream stream;
XBT_DEBUG("%s: event_type=%u", __func__, PAJE_DefineEntityValue);
@@
-315,7
+309,27
@@
static void on_entity_value_creation(EntityValue& value)
tracing_file << stream.str() << std::endl;
}
-static void on_type_creation(Type& type, e_event_type event_type)
+static void on_event_creation(PajeEvent& event)
+{
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event.eventType_, trace_precision, event.timestamp_);
+ event.stream_ << std::fixed << std::setprecision(trace_precision);
+ event.stream_ << event.eventType_ << " " << event.timestamp_ << " ";
+ event.stream_ << event.get_type()->get_id() << " " << event.get_container()->get_id();
+}
+
+static void on_event_destruction(const PajeEvent& event)
+{
+ XBT_DEBUG("Dump %s", event.stream_.str().c_str());
+ tracing_file << event.stream_.str() << std::endl;
+}
+
+static void on_state_event_destruction(const StateEvent& event)
+{
+ if (event.has_extra())
+ *tracing_files.at(event.get_container()) << event.stream_.str() << std::endl;
+}
+
+static void on_type_creation(const Type& type, e_event_type event_type)
{
if (event_type == PAJE_DefineLinkType)
return; // this kind of type has to be handled differently
@@
-330,7
+344,7
@@
static void on_type_creation(Type& type, e_event_type event_type)
tracing_file << stream.str() << std::endl;
}
-static void on_link_type_creation(
Type& type, Type& source,
Type& dest)
+static void on_link_type_creation(
const Type& type, const Type& source, const
Type& dest)
{
std::stringstream stream;
XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, trace_precision, 0.);
@@
-370,6
+384,8
@@
static void on_simulation_start()
EntityValue::on_creation.connect(on_entity_value_creation);
Type::on_creation.connect(on_type_creation);
LinkType::on_creation.connect(on_link_type_creation);
+ PajeEvent::on_creation.connect(on_event_creation);
+ PajeEvent::on_destruction.connect(on_event_destruction);
paje::dump_generator_version();
@@
-385,6
+401,7
@@
static void on_simulation_start()
trace_format = TraceFormat::Ti;
Container::on_creation.connect(on_container_creation_ti);
Container::on_destruction.connect(on_container_destruction_ti);
+ StateEvent::on_destruction.connect(on_state_event_destruction);
}
trace_active = true;