Skip to content

Commit

Permalink
Disable tooth logger if ptrace is started rusefi#5983
Browse files Browse the repository at this point in the history
  • Loading branch information
andreika-git committed Feb 22, 2024
1 parent 178e1f3 commit d4d4ddb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions firmware/console/binary/tooth_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,8 @@ void EnableToothLoggerIfNotEnabled() {
}
}

bool IsToothLoggerEnabled() {
return ToothLoggerEnabled;
}

#endif /* EFI_TOOTH_LOGGER */
2 changes: 2 additions & 0 deletions firmware/console/binary/tooth_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void EnableToothLogger();
// Stop logging - leave buffer intact
void DisableToothLogger();

bool IsToothLoggerEnabled();

// A new tooth has arrived! Log to the buffer if enabled.
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp);

Expand Down
6 changes: 6 additions & 0 deletions firmware/development/perf_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ void perfEventInstantGlobal(PE event) {
}

void perfTraceEnable() {
// force release of the buffer if occupied by the tooth logger
if (IsToothLoggerEnabled()) {
// don't worry, it will be automatically enabled
// when the next TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY command arrives
DisableToothLogger();
}
s_traceBuffer = getBigBuffer(BigBufferUser::PerfTrace);
s_isTracing = true;
}
Expand Down

0 comments on commit d4d4ddb

Please sign in to comment.