Merge branch 'main' into developing

This commit is contained in:
Gabriel Wang 2022-08-09 00:39:13 +01:00
commit 4f36589895
2 changed files with 7 additions and 6 deletions

View File

@ -2,13 +2,12 @@ Import('rtconfig')
from building import *
import shutil
src = ['perf_counter.c']
src = ['perf_counter.c', 'os/perf_os_patch_rt_thread.c']
cwd = GetCurrentDir()
path = [cwd]
CPPDEFINES = ['__PERF_COUNT_PLATFORM_SPECIFIC_HEADER__=<rtthread.h>', '__perf_counter_printf__=rt_kprintf']
if GetDepend('PKG_PERF_COUNTER_USING_THREAD_STATISTIC'):
src += ['os/perf_os_patch_rt_thread.c']
CPPDEFINES += ['__PERF_CNT_USE_RTOS__']
#delate unused files

View File

@ -49,8 +49,6 @@ struct __task_cycle_info_t {
uint32_t wMagicWord;
} ;
#ifndef RT_USING_HOOK
#error "In order to use perf_counter:RT-Thread-Patch, please define RT_USING_HOOK \
in rtconfig.h. If you don't want to use this patch, please un-select it in RTE."
@ -82,10 +80,12 @@ task_cycle_info_t * get_rtos_task_cycle_info(void)
void __perf_os_patch_init(void)
{
#ifdef PKG_USING_PERF_COUNTER
#ifdef PKG_PERF_COUNTER_USING_THREAD_STATISTIC
rt_tick_sethook(user_code_insert_to_systick_handler);
#endif
#if !defined(PKG_USING_PERF_COUNTER) || (defined(PKG_PERF_COUNTER_USING_THREAD_STATISTIC))
rt_scheduler_sethook(__rt_thread_scheduler_hook);
#endif
}
#ifdef PKG_USING_PERF_COUNTER
@ -93,6 +93,7 @@ void __ensure_systick_wrapper(void)
{
}
#ifdef PKG_PERF_COUNTER_USING_THREAD_STATISTIC
#define DBG_TAG "perf_counter"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
@ -105,4 +106,5 @@ static int _perf_counter_init(void)
return 0;
}
INIT_PREV_EXPORT(_perf_counter_init);
#endif
#endif /* PKG_PERF_COUNTER_USING_THREAD_STATISTIC */
#endif /* PKG_USING_PERF_COUNTER */