@@ -119,20 +119,26 @@ class ChromeTracer {
119
119
void AddCompleteEvent (const std::string& name, uint64_t pid, uint64_t tid,
120
120
PerfClock::time_point start, PerfClock::time_point end,
121
121
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 << " ,"
124
126
<< " \" ts\" :" << Micros (start - origin_).count () << " ,"
125
- << " \" dur\" :" << Micros (end - start).count () << " ," << " \" args\" :{" ;
127
+ << " \" dur\" :" << Micros (end - start).count () << " ,"
128
+ << " \" args\" :{" ;
126
129
AddArgs (args...);
127
130
*out_ << " }},\n " ;
128
131
}
129
132
130
133
template <typename ... Args>
131
134
void AddAsyncBeginEvent (const std::string& name, uint64_t pid, uint64_t id,
132
135
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 () << " ,"
136
142
<< " \" args\" :{" ;
137
143
AddArgs (args...);
138
144
*out_ << " }},\n " ;
@@ -141,9 +147,12 @@ class ChromeTracer {
141
147
template <typename ... Args>
142
148
void AddAsyncInstantEvent (const std::string& name, uint64_t pid, uint64_t id,
143
149
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 () << " ,"
147
156
<< " \" args\" :{" ;
148
157
AddArgs (args...);
149
158
*out_ << " }},\n " ;
@@ -152,15 +161,19 @@ class ChromeTracer {
152
161
template <typename ... Args>
153
162
void AddAsyncEndEvent (const std::string& name, uint64_t pid, uint64_t id,
154
163
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 " ;
158
170
}
159
171
160
172
template <typename ... Args>
161
173
void AddCounterEvent (const std::string& name, uint64_t pid,
162
174
PerfClock::time_point time, const Args... args) {
163
- *out_ << " {\" name\" :\" " << name << " \" ," << " \" ph\" : \" C\" ,"
175
+ *out_ << " {\" name\" :\" " << name << " \" ,"
176
+ << " \" ph\" : \" C\" ,"
164
177
<< " \" pid\" :" << pid << " ,"
165
178
<< " \" ts\" :" << Micros (time - origin_).count () << " ,"
166
179
<< " \" args\" :{ " ;
@@ -720,13 +733,15 @@ void AsyncLog::LogDetail(const std::string& key, const T& value,
720
733
}
721
734
auto time_ns = (log_detail_time_ - log_origin_).count ();
722
735
for (auto os : detail_streams) {
723
- *os << " :::MLLOG {" << " \" key\" : " << ArgValueTransform (key) << " , "
736
+ *os << " :::MLLOG {"
737
+ << " \" key\" : " << ArgValueTransform (key) << " , "
724
738
<< " \" value\" : " << ArgValueTransform (value) << " , "
725
739
<< " \" time_ms\" : " << ArgValueTransform (time_ns / 1000000ULL ) << " ."
726
740
<< std::setfill (' 0' ) << std::setw (6 )
727
741
<< ArgValueTransform (time_ns % 1000000ULL ) << " , "
728
742
<< " \" namespace\" : \" mlperf::logging\" , "
729
- << " \" event_type\" : \" POINT_IN_TIME\" , " << " \" metadata\" : {"
743
+ << " \" event_type\" : \" POINT_IN_TIME\" , "
744
+ << " \" metadata\" : {"
730
745
<< " \" is_error\" : " << ArgValueTransform (error_flagged_) << " , "
731
746
<< " \" is_warning\" : " << ArgValueTransform (warning_flagged_) << " , "
732
747
<< " \" file\" : \" " << file_name << " \" , "
@@ -755,9 +770,9 @@ void AsyncLog::LogDetail(const std::string& message, const Args... args) {
755
770
detail_streams.pop_back ();
756
771
}
757
772
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 : " ;
761
776
if (error_flagged_) {
762
777
*os << " ERROR : " ;
763
778
} else if (warning_flagged_) {
0 commit comments