From: 이한종/On-Device Lab(SR)/Engineer/삼성전자 Date: Fri, 29 Nov 2019 07:06:51 +0000 (+0900) Subject: [neurun] Organise Chrome Trace data by backend (#9277) X-Git-Tag: submit/tizen/20191205.083104~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23d29be56fcc8dc3aa1995574c4dbc2e66ac0948;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Organise Chrome Trace data by backend (#9277) Organise Chrome Trace data by backend Signed-off-by: Hanjoung Lee --- diff --git a/runtime/libs/misc/include/misc/EventCollector.h b/runtime/libs/misc/include/misc/EventCollector.h index bcb2d07..530a909 100644 --- a/runtime/libs/misc/include/misc/EventCollector.h +++ b/runtime/libs/misc/include/misc/EventCollector.h @@ -31,6 +31,7 @@ public: struct Event { Edge edge; + std::string backend; std::string label; }; diff --git a/runtime/libs/misc/include/misc/EventRecorder.h b/runtime/libs/misc/include/misc/EventRecorder.h index e5fb34d..510ce0c 100644 --- a/runtime/libs/misc/include/misc/EventRecorder.h +++ b/runtime/libs/misc/include/misc/EventRecorder.h @@ -26,6 +26,7 @@ struct Event { std::string name; + std::string tid; std::string ph; /* REQUIRED */ std::string ts; /* REQUIRED */ }; diff --git a/runtime/libs/misc/src/EventCollector.cpp b/runtime/libs/misc/src/EventCollector.cpp index 8a77100..452a291 100644 --- a/runtime/libs/misc/src/EventCollector.cpp +++ b/runtime/libs/misc/src/EventCollector.cpp @@ -38,11 +38,12 @@ class DurationEventBuilder public: DurationEventBuilder(const std::string &ts) : _ts{ts} {} - DurationEvent build(const std::string &name, const std::string &ph) const + DurationEvent build(const std::string &tid, const std::string &name, const std::string &ph) const { DurationEvent evt; evt.name = name; + evt.tid = tid; evt.ph = ph; evt.ts = _ts; @@ -90,11 +91,11 @@ void EventCollector::onEvent(const Event &event) switch (event.edge) { case Edge::BEGIN: - _rec->emit(DurationEventBuilder(ts).build(event.label, "B")); + _rec->emit(DurationEventBuilder(ts).build(event.backend, event.label, "B")); break; case Edge::END: - _rec->emit(DurationEventBuilder(ts).build(event.label, "E")); + _rec->emit(DurationEventBuilder(ts).build(event.backend, event.label, "E")); break; } diff --git a/runtime/libs/misc/src/EventRecorder.cpp b/runtime/libs/misc/src/EventRecorder.cpp index 7d904f2..c17d80e 100644 --- a/runtime/libs/misc/src/EventRecorder.cpp +++ b/runtime/libs/misc/src/EventRecorder.cpp @@ -77,7 +77,7 @@ void fill(Content &content, const Event &evt) { content.flds.emplace_back("name", evt.name); content.flds.emplace_back("pid", "0"); - content.flds.emplace_back("tid", "0"); + content.flds.emplace_back("tid", evt.tid); content.flds.emplace_back("ph", evt.ph); content.flds.emplace_back("ts", evt.ts); } diff --git a/runtime/neurun/core/src/exec/ExecutionObservers.cc b/runtime/neurun/core/src/exec/ExecutionObservers.cc index 894b3e0..46f89fb 100644 --- a/runtime/neurun/core/src/exec/ExecutionObservers.cc +++ b/runtime/neurun/core/src/exec/ExecutionObservers.cc @@ -91,15 +91,19 @@ void ChromeTracingObserver::handleBegin(IExecutor *) } void ChromeTracingObserver::handleBegin(IExecutor *, const model::Subgraph *subgraph, - const backend::Backend *) + const backend::Backend *backend) { - _collector.onEvent(EventCollector::Event{EventCollector::Edge::BEGIN, subgraphTag(subgraph)}); + std::string backend_id = backend->config()->id(); + _collector.onEvent( + EventCollector::Event{EventCollector::Edge::BEGIN, backend_id, subgraphTag(subgraph)}); } void ChromeTracingObserver::handleEnd(IExecutor *, const model::Subgraph *subgraph, - const backend::Backend *) + const backend::Backend *backend) { - _collector.onEvent(EventCollector::Event{EventCollector::Edge::END, subgraphTag(subgraph)}); + std::string backend_id = backend->config()->id(); + _collector.onEvent( + EventCollector::Event{EventCollector::Edge::END, backend_id, subgraphTag(subgraph)}); } void ChromeTracingObserver::handleEnd(IExecutor *)