@@ -119,20 +119,26 @@ class ChromeTracer {
119119 void AddCompleteEvent (const std::string& name, uint64_t pid, uint64_t tid,
120120 PerfClock::time_point start, PerfClock::time_point end,
121121 const Args... args) {
122- *out_ << " {\" name\" :\" " << name << " \" ," << " \" ph\" :\" X\" ,"
123- << " \" pid\" :" << pid << " ," << " \" tid\" :" << tid << " ,"
122+ *out_ << " {\" name\" :\" " << name << " \" ,"
123+ << " \" ph\" :\" X\" ,"
124+ << " \" pid\" :" << pid << " ,"
125+ << " \" tid\" :" << tid << " ,"
124126 << " \" ts\" :" << Micros (start - origin_).count () << " ,"
125- << " \" dur\" :" << Micros (end - start).count () << " ," << " \" args\" :{" ;
127+ << " \" dur\" :" << Micros (end - start).count () << " ,"
128+ << " \" args\" :{" ;
126129 AddArgs (args...);
127130 *out_ << " }},\n " ;
128131 }
129132
130133 template <typename ... Args>
131134 void AddAsyncBeginEvent (const std::string& name, uint64_t pid, uint64_t id,
132135 PerfClock::time_point time, const Args... args) {
133- *out_ << " {\" name\" :\" " << name << " \" ," << " \" cat\" :\" default\" ,"
134- << " \" ph\" :\" b\" ," << " \" pid\" :" << pid << " ," << " \" id\" :" << id
135- << " ," << " \" ts\" :" << Micros (time - origin_).count () << " ,"
136+ *out_ << " {\" name\" :\" " << name << " \" ,"
137+ << " \" cat\" :\" default\" ,"
138+ << " \" ph\" :\" b\" ,"
139+ << " \" pid\" :" << pid << " ,"
140+ << " \" id\" :" << id << " ,"
141+ << " \" ts\" :" << Micros (time - origin_).count () << " ,"
136142 << " \" args\" :{" ;
137143 AddArgs (args...);
138144 *out_ << " }},\n " ;
@@ -141,9 +147,12 @@ class ChromeTracer {
141147 template <typename ... Args>
142148 void AddAsyncInstantEvent (const std::string& name, uint64_t pid, uint64_t id,
143149 PerfClock::time_point time, const Args... args) {
144- *out_ << " {\" name\" :\" " << name << " \" ," << " \" cat\" :\" default\" ,"
145- << " \" ph\" :\" n\" ," << " \" pid\" :" << pid << " ," << " \" id\" :" << id
146- << " ," << " \" ts\" :" << Micros (time - origin_).count () << " ,"
150+ *out_ << " {\" name\" :\" " << name << " \" ,"
151+ << " \" cat\" :\" default\" ,"
152+ << " \" ph\" :\" n\" ,"
153+ << " \" pid\" :" << pid << " ,"
154+ << " \" id\" :" << id << " ,"
155+ << " \" ts\" :" << Micros (time - origin_).count () << " ,"
147156 << " \" args\" :{" ;
148157 AddArgs (args...);
149158 *out_ << " }},\n " ;
@@ -152,15 +161,19 @@ class ChromeTracer {
152161 template <typename ... Args>
153162 void AddAsyncEndEvent (const std::string& name, uint64_t pid, uint64_t id,
154163 PerfClock::time_point time) {
155- *out_ << " {\" name\" :\" " << name << " \" ," << " \" cat\" :\" default\" ,"
156- << " \" ph\" :\" e\" , " << " \" pid\" :" << pid << " ," << " \" id\" :" << id
157- << " ," << " \" ts\" :" << Micros (time - origin_).count () << " },\n " ;
164+ *out_ << " {\" name\" :\" " << name << " \" ,"
165+ << " \" cat\" :\" default\" ,"
166+ << " \" ph\" :\" e\" , "
167+ << " \" pid\" :" << pid << " ,"
168+ << " \" id\" :" << id << " ,"
169+ << " \" ts\" :" << Micros (time - origin_).count () << " },\n " ;
158170 }
159171
160172 template <typename ... Args>
161173 void AddCounterEvent (const std::string& name, uint64_t pid,
162174 PerfClock::time_point time, const Args... args) {
163- *out_ << " {\" name\" :\" " << name << " \" ," << " \" ph\" : \" C\" ,"
175+ *out_ << " {\" name\" :\" " << name << " \" ,"
176+ << " \" ph\" : \" C\" ,"
164177 << " \" pid\" :" << pid << " ,"
165178 << " \" ts\" :" << Micros (time - origin_).count () << " ,"
166179 << " \" args\" :{ " ;
@@ -720,13 +733,15 @@ void AsyncLog::LogDetail(const std::string& key, const T& value,
720733 }
721734 auto time_ns = (log_detail_time_ - log_origin_).count ();
722735 for (auto os : detail_streams) {
723- *os << " :::MLLOG {" << " \" key\" : " << ArgValueTransform (key) << " , "
736+ *os << " :::MLLOG {"
737+ << " \" key\" : " << ArgValueTransform (key) << " , "
724738 << " \" value\" : " << ArgValueTransform (value) << " , "
725739 << " \" time_ms\" : " << ArgValueTransform (time_ns / 1000000ULL ) << " ."
726740 << std::setfill (' 0' ) << std::setw (6 )
727741 << ArgValueTransform (time_ns % 1000000ULL ) << " , "
728742 << " \" namespace\" : \" mlperf::logging\" , "
729- << " \" event_type\" : \" POINT_IN_TIME\" , " << " \" metadata\" : {"
743+ << " \" event_type\" : \" POINT_IN_TIME\" , "
744+ << " \" metadata\" : {"
730745 << " \" is_error\" : " << ArgValueTransform (error_flagged_) << " , "
731746 << " \" is_warning\" : " << ArgValueTransform (warning_flagged_) << " , "
732747 << " \" file\" : \" " << file_name << " \" , "
@@ -755,9 +770,9 @@ void AsyncLog::LogDetail(const std::string& message, const Args... args) {
755770 detail_streams.pop_back ();
756771 }
757772 for (auto os : detail_streams) {
758- *os << " \" pid\" : " << current_pid_ << " , " << " \" tid \" : " << current_tid_
759- << " , " << " \" ts \" : " << (log_detail_time_ - log_origin_). count ()
760- << " ns : " ;
773+ *os << " \" pid\" : " << current_pid_ << " , "
774+ << " \" tid \" : " << current_tid_ << " , "
775+ << " \" ts \" : " << (log_detail_time_ - log_origin_). count () << " ns : " ;
761776 if (error_flagged_) {
762777 *os << " ERROR : " ;
763778 } else if (warning_flagged_) {
0 commit comments