trace global lock/unlock (#1582)

* trace global lock/unlock

* bootloader stub

* add to java

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-07-10 20:27:27 -07:00 committed by GitHub
parent 3f5ce01245
commit 38d3641c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 22 deletions

View File

@ -34,4 +34,6 @@ void irqEnterHook() {}
void irqExitHook() {}
void contextSwitchHook() {}
void threadInitHook(void*) {}
void onLockHook() {}
void onUnlockHook() {}
//#endif /* ENABLE_PERF_TRACE */

View File

@ -22,29 +22,15 @@ extern "C"
void irqExitHook(void);
void contextSwitchHook(void);
void threadInitHook(void* tp);
void onLockHook(void);
void onUnlockHook(void);
#endif /* __ASSEMBLER__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#if EFI_CLOCK_LOCKS
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifndef __ASSEMBLER__
void onLockHook(void);
void onUnlockHook(void);
#endif /* __ASSEMBLER__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define ON_LOCK_HOOK onLockHook()
#define ON_UNLOCK_HOOK onUnlockHook()
#else /* EFI_CLOCK_LOCKS */
#define ON_LOCK_HOOK
#define ON_UNLOCK_HOOK
#endif /* EFI_CLOCK_LOCKS */
#define ON_LOCK_HOOK onLockHook()
#define ON_UNLOCK_HOOK onUnlockHook()
#if !defined(_FROM_ASM_)
#ifdef __cplusplus

View File

@ -7,6 +7,7 @@
#include "engine.h"
#include "os_access.h"
#include "perf_trace.h"
static char warningBuffer[ERROR_BUFFER_SIZE];
static critical_msg_t criticalErrorMessageBuffer;
@ -205,11 +206,18 @@ uint32_t maxLockedDuration = 0;
+#define _dbg_leave_lock() {ON_UNLOCK_HOOK;(ch.dbg.lock_cnt = (cnt_t)0);}
#endif
*/
#endif /* EFI_CLOCK_LOCKS */
void onLockHook(void) {
perfEventInstantGlobal(PE::GlobalLock);
#if EFI_CLOCK_LOCKS
lastLockTime = getTimeNowLowerNt();
#endif /* EFI_CLOCK_LOCKS */
}
void onUnlockHook(void) {
#if EFI_CLOCK_LOCKS
uint32_t lockedDuration = getTimeNowLowerNt() - lastLockTime;
if (lockedDuration > maxLockedDuration) {
maxLockedDuration = lockedDuration;
@ -218,10 +226,11 @@ void onUnlockHook(void) {
// // un-comment this if you want a nice stop for a breakpoint
// maxLockedDuration = lockedDuration + 1;
// }
}
#endif /* EFI_CLOCK_LOCKS */
perfEventInstantGlobal(PE::GlobalUnlock);
}
void firmwareError(obd_code_e code, const char *fmt, ...) {
#if EFI_PROD_CODE
if (hasFirmwareErrorFlag)

View File

@ -60,6 +60,8 @@ enum class PE : uint8_t {
EngineSniffer,
PrepareIgnitionSchedule,
Hip9011IntHoldCallback,
GlobalLock,
GlobalUnlock,
// enum_end_tag
// The tag above is consumed by PerfTraceTool.java
// please note that the tool requires a comma at the end of last value

View File

@ -48,5 +48,7 @@ public class EnumNames {
"EngineSniffer",
"PrepareIgnitionSchedule",
"Hip9011IntHoldCallback",
"GlobalLock",
"GlobalUnlock",
};
}

View File

@ -39,8 +39,6 @@
#define BOARD_MC33972_COUNT 0
#define BOARD_TLE8888_COUNT 0
#define EFI_CLOCK_LOCKS FALSE
#define EFI_FSIO TRUE
#define EFI_TEXT_LOGGING TRUE