7 #include "../profiling/ProfilingUtils.hpp" 12 namespace timelinedecoder
16 if (m_OnNewEntityCallback ==
nullptr)
20 m_OnNewEntityCallback(m_Model, entity);
27 if (m_OnNewEventClassCallback ==
nullptr)
31 m_OnNewEventClassCallback(m_Model, eventClass);
38 if (m_OnNewEventCallback ==
nullptr)
42 m_OnNewEventCallback(m_Model, event);
49 if (m_OnNewLabelCallback ==
nullptr)
53 m_OnNewLabelCallback(m_Model, label);
60 if (m_OnNewRelationshipCallback ==
nullptr)
64 m_OnNewRelationshipCallback(m_Model, relationship);
79 m_OnNewEntityCallback = cb;
89 m_OnNewEventClassCallback = cb;
99 m_OnNewEventCallback = cb;
109 m_OnNewLabelCallback = cb;
119 m_OnNewRelationshipCallback = cb;
129 printRelationships();
132 void TimelineDecoder::printLabels()
137 header.append(
" | ");
141 std::cout <<
"\n" <<
"\n";
144 std::cout << std::string(header.size(),
'=') <<
"\n";
147 for (uint32_t i = 0; i < m_Model.
m_Labels.size(); ++i)
151 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Labels[i].m_Guid), 12));
153 body.append(profiling::CentreAlignFormatting(m_Model.
m_Labels[i].m_Name, 30));
156 std::cout << std::string(body.size(),
'-') <<
"\n";
161 void TimelineDecoder::printEntities()
167 std::cout <<
"\n" <<
"\n";
170 std::cout << std::string(header.size(),
'=') <<
"\n";
173 for (uint32_t i = 0; i < m_Model.
m_Entities.size(); ++i)
177 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Entities[i].m_Guid), 12));
180 std::cout << std::string(body.size(),
'-') <<
"\n";
185 void TimelineDecoder::printEventClasses()
191 std::cout <<
"\n" <<
"\n";
194 std::cout << std::string(header.size(),
'=') <<
"\n";
201 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_EventClasses[i].m_Guid), 12));
204 std::cout << std::string(body.size(),
'-') <<
"\n";
209 void TimelineDecoder::printEvents()
214 header.append(
" | ");
216 header.append(
" | ");
220 std::cout <<
"\n" <<
"\n";
223 std::cout << std::string(header.size(),
'=') <<
"\n";
226 for (uint32_t i = 0; i < m_Model.
m_Events.size(); ++i)
230 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Events[i].m_TimeStamp), 12));
233 std::stringstream ss;
234 ss << m_Model.
m_Events[i].m_ThreadId;
235 std::string threadId = ss.str();;
237 body.append(profiling::CentreAlignFormatting(threadId, 12));
239 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Events[i].m_Guid), 12));
242 std::cout << std::string(body.size(),
'-') <<
"\n";
247 void TimelineDecoder::printRelationships()
251 header.append(
" | ");
253 header.append(
" | ");
255 header.append(
" | ");
259 std::cout <<
"\n" <<
"\n";
262 std::cout << std::string(header.size(),
'=') <<
"\n";
270 profiling::CentreAlignFormatting(std::to_string(static_cast<unsigned int>
274 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Relationships[i].m_Guid), 20));
276 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Relationships[i].m_HeadGuid), 12));
278 body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.
m_Relationships[i].m_TailGuid), 12));
282 std::cout << std::string(body.size(),
'-') <<
"\n";
TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback)
std::vector< Label > m_Labels
std::vector< Entity > m_Entities
virtual TimelineStatus CreateEvent(const Event &) override
void(*)(Model &, const Relationship) OnNewRelationshipCallback
Copyright (c) 2020 ARM Limited.
virtual TimelineStatus CreateEntity(const Entity &) override
void(*)(Model &, const Event) OnNewEventCallback
virtual TimelineStatus CreateLabel(const Label &) override
TimelineStatus SetEventClassCallback(const OnNewEventClassCallback)
std::vector< Relationship > m_Relationships
void(*)(Model &, const Entity) OnNewEntityCallback
virtual TimelineStatus CreateRelationship(const Relationship &) override
std::vector< EventClass > m_EventClasses
void(*)(Model &, const EventClass) OnNewEventClassCallback
virtual TimelineStatus CreateEventClass(const EventClass &) override
void(*)(Model &, const Label) OnNewLabelCallback
TimelineStatus SetLabelCallback(const OnNewLabelCallback)
std::string CentreAlignFormatting(const std::string &stringToPass, const int spacingWidth)
std::vector< Event > m_Events
TimelineStatus SetEntityCallback(const OnNewEntityCallback)
TimelineStatus SetEventCallback(const OnNewEventCallback)