mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_ChibiOS: when HAL_ENABLE_THREAD_STATISTICS is defined add ChibiOS thread stats to threads.txt
define HAL_ENABLE_THREAD_STATISTICS in hwdef.h
This commit is contained in:
parent
b6a008c73d
commit
83c8807b39
|
@ -325,9 +325,18 @@ size_t Util::thread_info(char *buf, size_t bufsize)
|
|||
total_stack = uint32_t(tp) - uint32_t(tp->wabase);
|
||||
}
|
||||
if (bufsize > 0) {
|
||||
#if HAL_ENABLE_THREAD_STATISTICS
|
||||
n = snprintf(buf, bufsize, "%-13.13s PRI=%3u sp=%p STACK=%4u/%4u MIN=%4u AVG=%4u MAX=%4u\n",
|
||||
tp->name, unsigned(tp->prio), tp->wabase,
|
||||
stack_free(tp->wabase), total_stack, RTC2US(STM32_HSECLK, tp->stats.best),
|
||||
RTC2US(STM32_HSECLK, uint32_t(tp->stats.cumulative / uint64_t(tp->stats.n))),
|
||||
RTC2US(STM32_HSECLK, tp->stats.worst));
|
||||
chTMObjectInit(&tp->stats); // reset counters to zero
|
||||
#else
|
||||
n = snprintf(buf, bufsize, "%-13.13s PRI=%3u sp=%p STACK=%u/%u\n",
|
||||
tp->name, unsigned(tp->prio), tp->wabase,
|
||||
stack_free(tp->wabase), total_stack);
|
||||
#endif
|
||||
if (n > bufsize) {
|
||||
n = bufsize;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||
#endif
|
||||
|
||||
#if HAL_ENABLE_THREAD_STATISTICS
|
||||
#define CH_DBG_STATISTICS TRUE
|
||||
#else
|
||||
#define CH_DBG_STATISTICS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief System time counter resolution.
|
||||
* @note Allowed values are 16 or 32 bits.
|
||||
|
@ -509,7 +515,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_STATISTICS)
|
||||
#define CH_DBG_STATISTICS TRUE
|
||||
#define CH_DBG_STATISTICS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -751,6 +751,12 @@ def write_mcu_config(f):
|
|||
f.write('\n// APJ board ID (for bootloaders)\n')
|
||||
f.write('#define APJ_BOARD_ID %s\n' % get_config('APJ_BOARD_ID'))
|
||||
|
||||
f.write('''
|
||||
#ifndef HAL_ENABLE_THREAD_STATISTICS
|
||||
#define HAL_ENABLE_THREAD_STATISTICS FALSE
|
||||
#endif
|
||||
''')
|
||||
|
||||
lib = get_mcu_lib(mcu_type)
|
||||
build_info = lib.build
|
||||
|
||||
|
@ -797,7 +803,6 @@ def write_mcu_config(f):
|
|||
#define HAL_NO_UARTDRIVER
|
||||
#define HAL_NO_PRINTF
|
||||
#define HAL_NO_CCM
|
||||
#define CH_DBG_STATISTICS FALSE
|
||||
#define CH_CFG_USE_TM FALSE
|
||||
#define CH_CFG_USE_REGISTRY FALSE
|
||||
#define CH_CFG_USE_WAITEXIT FALSE
|
||||
|
|
Loading…
Reference in New Issue