From 8df885f37bffa85ebeb5d416b0c16364565a8d23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 26 Nov 2019 12:50:06 +0900 Subject: [PATCH] [rt/misc] Do not flush buffer when Event Recording (#9198) EventRecorder does not have to flush buffer while recording an event. Flushing buffer every time may cause unnecessary overhead. Signed-off-by: Hanjoung Lee --- runtime/libs/misc/src/EventRecorder.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/runtime/libs/misc/src/EventRecorder.cpp b/runtime/libs/misc/src/EventRecorder.cpp index e234c06..7c3ab74 100644 --- a/runtime/libs/misc/src/EventRecorder.cpp +++ b/runtime/libs/misc/src/EventRecorder.cpp @@ -110,21 +110,15 @@ std::string object(const CounterEvent &evt) void EventRecorder::init() { _os << "{" << std::endl; - _os << " " << quote("traceEvents") << ": [" << std::endl; + _os << " " << quote("traceEvents") << ": [\n"; } -void EventRecorder::emit(const DurationEvent &evt) -{ - _os << " " << object(evt) << "," << std::endl; -} -void EventRecorder::emit(const CounterEvent &evt) -{ - _os << " " << object(evt) << "," << std::endl; -} +void EventRecorder::emit(const DurationEvent &evt) { _os << " " << object(evt) << ",\n"; } +void EventRecorder::emit(const CounterEvent &evt) { _os << " " << object(evt) << ",\n"; } void EventRecorder::fini() { - _os << " { }" << std::endl; - _os << " ]" << std::endl; - _os << "}" << std::endl; + _os << " { }\n"; + _os << " ]\n"; + _os << "}\n"; } -- 2.7.4