@@ -181,6 +181,7 @@ std::vector<std::vector<Event>> DisableProfiler() {
181
181
182
182
void ParseEvents (std::vector<std::vector<Event>>& events,
183
183
EventSortingKey sorted_by) {
184
+ if (g_profiler_place == " " ) return ;
184
185
std::vector<std::vector<EventItem>> events_table;
185
186
size_t max_name_width = 0 ;
186
187
for (size_t i = 0 ; i < events.size (); i++) {
@@ -199,7 +200,7 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
199
200
}
200
201
201
202
if (rit != pushed_events.rend ()) {
202
- double event_time = (g_state == ProfilerState:: kCUDA )
203
+ double event_time = (g_profiler_place == " CUDA " )
203
204
? rit->CudaElapsedMs (events[i][j])
204
205
: rit->CpuElapsedMs (events[i][j]);
205
206
std::string event_name =
@@ -224,7 +225,7 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
224
225
std::max (event_time, event_items[index].max_time );
225
226
}
226
227
227
- // remove the start marker from the list
228
+ // remove the push marker from the list
228
229
pushed_events.erase ((++rit).base ());
229
230
} else {
230
231
LOG (WARNING) << " Cannot find the push marker of event \' "
@@ -257,13 +258,11 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
257
258
}
258
259
259
260
events_table.push_back (event_items);
260
- // To check whether there are events with `push` but without `pop`
261
+ // log warning if there are events with `push` but without `pop`
261
262
std::list<Event>::reverse_iterator rit = pushed_events.rbegin ();
262
263
while (rit != pushed_events.rend ()) {
263
- if (rit->kind () == " push" ) {
264
- LOG (WARNING) << " Cannot find the pop marker of event \' " << rit->name ()
265
- << " \' , which will be ignored in profiling report." ;
266
- }
264
+ LOG (WARNING) << " Cannot find the pop marker of event \' " << rit->name ()
265
+ << " \' , which will be ignored in profiling report." ;
267
266
++rit;
268
267
}
269
268
}
@@ -275,7 +274,6 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
275
274
void PrintProfilingReport (std::vector<std::vector<EventItem>>& events_table,
276
275
EventSortingKey sorted_by, const size_t name_width,
277
276
const size_t data_width) {
278
- if (g_profiler_place == " " ) return ;
279
277
// Output header information
280
278
std::cout << " \n ------------------------->"
281
279
<< " Profiling Report "
0 commit comments