main
JiXieShi 2024-11-27 22:11:09 +08:00
parent a0783abd1a
commit 9d10e34746
2 changed files with 13 additions and 11 deletions

View File

@ -44,7 +44,10 @@ void exampleTimer4Callback(Task_t *task, void *userData) {
#undef LOG_RUN_TIMER_FUN
#define LOG_RUN_TIMER_FUN GetTick()
int Test_task(void *pVoid) {
LOG_RUN_TIME() {
LOG_RUN_TIME("Init Timer", {
printf("%llu", __time_count__);
}) {
TaskInit(GetTick);
TaskCreat(task1, 1000, -1, exampleTimer1Callback, "1000ms CYCLE task");
TaskCreat(task2, 5000, -1, exampleTimer2Callback, "5000ms ONCE task");
@ -56,7 +59,6 @@ int Test_task(void *pVoid) {
TaskCreat(task4, 2000, 1, exampleTimer4Callback, &customUserData);
}
while (1) {
TaskRun();
}

View File

@ -175,14 +175,14 @@
#ifndef LOG_RUN_TIME
#ifndef __PLOOC_VA_NUM_ARGS_IMPL
# define __PLOOC_VA_NUM_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, \
#ifndef __LOG_VA_NUM_ARGS_IMPL
# define __LOG_VA_NUM_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, \
_12, _13, _14, _15, _16, __N, ...) __N
#endif
#ifndef __PLOOC_VA_NUM_ARGS
#define __PLOOC_VA_NUM_ARGS(...) \
__PLOOC_VA_NUM_ARGS_IMPL( 0,##__VA_ARGS__,16,15,14,13,12,11,10,9, \
#ifndef __LOG_VA_NUM_ARGS
#define __LOG_VA_NUM_ARGS(...) \
__LOG_VA_NUM_ARGS_IMPL( 0,##__VA_ARGS__,16,15,14,13,12,11,10,9, \
8,7,6,5,4,3,2,1,0)
#endif
@ -247,7 +247,7 @@
__CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)
#define CONNECT(...) \
ALT_CONNECT2(CONNECT, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
ALT_CONNECT2(CONNECT, __LOG_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
#undef __using1
#undef __using2
@ -281,7 +281,7 @@
)
#define using(...) \
CONNECT2(__using, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
CONNECT2(__using, __LOG_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
#ifdef LOG_WITH_RUN_TIMER
#define LOG_RUN_TIME(__STR, ...) \
@ -291,7 +291,7 @@
__ticks_sync_barrier__(); \
_ = LOG_RUN_TIMER_FUN - _; \
__time_count__ = _; \
if (__PLOOC_VA_NUM_ARGS(__VA_ARGS__) == 0) { \
if (__LOG_VA_NUM_ARGS(__VA_ARGS__) == 0) { \
LOG_OUT_FUNC("\r\n"); \
LOG_OUT_FUNC("-[Run Timer]"); \
LOG_OUT_FUNC( \
@ -311,7 +311,7 @@
__ticks_sync_barrier__(); \
_ = LOG_RUN_TIMER_FUN - _; \
__time_count__ = _; \
if (__PLOOC_VA_NUM_ARGS(__VA_ARGS__) == 0) { \
if (__LOG_VA_NUM_ARGS(__VA_ARGS__) == 0) { \
LOG_OUT_FUNC("\r\n"); \
LOG_OUT_FUNC("-[Run Timer]"); \
LOG_OUT_FUNC( \