UP log
parent
a0783abd1a
commit
9d10e34746
|
@ -44,7 +44,10 @@ void exampleTimer4Callback(Task_t *task, void *userData) {
|
||||||
#undef LOG_RUN_TIMER_FUN
|
#undef LOG_RUN_TIMER_FUN
|
||||||
#define LOG_RUN_TIMER_FUN GetTick()
|
#define LOG_RUN_TIMER_FUN GetTick()
|
||||||
int Test_task(void *pVoid) {
|
int Test_task(void *pVoid) {
|
||||||
LOG_RUN_TIME() {
|
|
||||||
|
LOG_RUN_TIME("Init Timer", {
|
||||||
|
printf("%llu", __time_count__);
|
||||||
|
}) {
|
||||||
TaskInit(GetTick);
|
TaskInit(GetTick);
|
||||||
TaskCreat(task1, 1000, -1, exampleTimer1Callback, "1000ms CYCLE task");
|
TaskCreat(task1, 1000, -1, exampleTimer1Callback, "1000ms CYCLE task");
|
||||||
TaskCreat(task2, 5000, -1, exampleTimer2Callback, "5000ms ONCE task");
|
TaskCreat(task2, 5000, -1, exampleTimer2Callback, "5000ms ONCE task");
|
||||||
|
@ -56,7 +59,6 @@ int Test_task(void *pVoid) {
|
||||||
TaskCreat(task4, 2000, 1, exampleTimer4Callback, &customUserData);
|
TaskCreat(task4, 2000, 1, exampleTimer4Callback, &customUserData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
TaskRun();
|
TaskRun();
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,14 +175,14 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef LOG_RUN_TIME
|
#ifndef LOG_RUN_TIME
|
||||||
#ifndef __PLOOC_VA_NUM_ARGS_IMPL
|
#ifndef __LOG_VA_NUM_ARGS_IMPL
|
||||||
# define __PLOOC_VA_NUM_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, \
|
# 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
|
_12, _13, _14, _15, _16, __N, ...) __N
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __PLOOC_VA_NUM_ARGS
|
#ifndef __LOG_VA_NUM_ARGS
|
||||||
#define __PLOOC_VA_NUM_ARGS(...) \
|
#define __LOG_VA_NUM_ARGS(...) \
|
||||||
__PLOOC_VA_NUM_ARGS_IMPL( 0,##__VA_ARGS__,16,15,14,13,12,11,10,9, \
|
__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)
|
8,7,6,5,4,3,2,1,0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
__CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)
|
__CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)
|
||||||
|
|
||||||
#define CONNECT(...) \
|
#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 __using1
|
||||||
#undef __using2
|
#undef __using2
|
||||||
|
@ -281,7 +281,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
#define using(...) \
|
#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
|
#ifdef LOG_WITH_RUN_TIMER
|
||||||
#define LOG_RUN_TIME(__STR, ...) \
|
#define LOG_RUN_TIME(__STR, ...) \
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
__ticks_sync_barrier__(); \
|
__ticks_sync_barrier__(); \
|
||||||
_ = LOG_RUN_TIMER_FUN - _; \
|
_ = LOG_RUN_TIMER_FUN - _; \
|
||||||
__time_count__ = _; \
|
__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("\r\n"); \
|
||||||
LOG_OUT_FUNC("-[Run Timer]"); \
|
LOG_OUT_FUNC("-[Run Timer]"); \
|
||||||
LOG_OUT_FUNC( \
|
LOG_OUT_FUNC( \
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
__ticks_sync_barrier__(); \
|
__ticks_sync_barrier__(); \
|
||||||
_ = LOG_RUN_TIMER_FUN - _; \
|
_ = LOG_RUN_TIMER_FUN - _; \
|
||||||
__time_count__ = _; \
|
__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("\r\n"); \
|
||||||
LOG_OUT_FUNC("-[Run Timer]"); \
|
LOG_OUT_FUNC("-[Run Timer]"); \
|
||||||
LOG_OUT_FUNC( \
|
LOG_OUT_FUNC( \
|
||||||
|
|
Loading…
Reference in New Issue