Skip to content

Commit 3c2b65b

Browse files
tarun292facebook-github-bot
authored andcommitted
Exclude log_outputs() from execute profiling scope
Summary: `log_outputs()` should not be included in the `execute()` profiling scope as it distorts the profiling numbers especially on smaller embedded platforms like Xtensa. Differential Revision: D64541740
1 parent 6b858f2 commit 3c2b65b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

runtime/executor/method.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,8 +1191,7 @@ Error Method::step() {
11911191
static_cast<int32_t>(step_state_.chain_idx),
11921192
static_cast<uint32_t>(step_state_.instr_idx));
11931193
EXECUTORCH_SCOPE_PROF("Method::step");
1194-
internal::EventTracerProfileMethodScope event_tracer_profile_scope =
1195-
internal::EventTracerProfileMethodScope(event_tracer_, "Method::step");
1194+
EventTracerEntry event_tracer_entry = internal::event_tracer_begin_profiling_event(event_tracer_, "Method::step");
11961195
ET_CHECK_OR_RETURN_ERROR(
11971196
initialized(),
11981197
InvalidState,
@@ -1218,6 +1217,7 @@ Error Method::step() {
12181217
return status;
12191218
}
12201219

1220+
internal::event_tracer_end_profiling_event(event_tracer_, event_tracer_entry);
12211221
// end of the current chain, advance to the next chain
12221222
if (step_state_.instr_idx == num_instructions) {
12231223
step_state_.instr_idx = 0;
@@ -1233,8 +1233,7 @@ Error Method::experimental_step() {
12331233

12341234
Error Method::execute() {
12351235
internal::event_tracer_create_event_block(event_tracer_, "Execute");
1236-
internal::EventTracerProfileMethodScope event_tracer_profile_scope =
1237-
internal::EventTracerProfileMethodScope(event_tracer_, "Method::execute");
1236+
EventTracerEntry event_tracer_entry = internal::event_tracer_begin_profiling_event(event_tracer_, "Method::execute");
12381237
EXECUTORCH_SCOPE_PROF("Method::execute");
12391238
ET_CHECK_OR_RETURN_ERROR(
12401239
initialized(),
@@ -1270,7 +1269,7 @@ Error Method::execute() {
12701269
}
12711270
}
12721271
}
1273-
1272+
internal::event_tracer_end_profiling_event(event_tracer_, event_tracer_entry);
12741273
log_outputs();
12751274

12761275
// TODO(jakeszwe, dbort): Decide on calling execute back to back without

0 commit comments

Comments
 (0)