clock: replace all up_perf_xx with perf_xx

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
yinshengkai
2023-09-28 16:37:27 +08:00
committed by Mateusz Szafoni
parent b99820744c
commit ddb87d3b86
17 changed files with 86 additions and 148 deletions
+3 -10
View File
@@ -234,20 +234,13 @@ static void note_common(FAR struct tcb_s *tcb,
FAR struct note_common_s *note, FAR struct note_common_s *note,
uint8_t length, uint8_t type) uint8_t length, uint8_t type)
{ {
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT
struct timespec perftime;
#endif
struct timespec ts; struct timespec ts;
clock_systime_timespec(&ts); perf_convert(perf_gettime(), &ts);
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT
up_perf_convert(up_perf_gettime(), &perftime);
ts.tv_nsec = perftime.tv_nsec;
#endif
/* Save all of the common fields */ /* Save all of the common fields */
note->nc_length = length; note->nc_length = length;
note->nc_type = type; note->nc_type = type;
if (tcb == NULL) if (tcb == NULL)
{ {
+7 -24
View File
@@ -41,11 +41,7 @@ struct notesnap_chunk_s
uint8_t cpu; uint8_t cpu;
#endif #endif
pid_t pid; pid_t pid;
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT clock_t count;
unsigned long count;
#else
struct timespec time;
#endif
uintptr_t args; uintptr_t args;
}; };
@@ -216,11 +212,7 @@ static inline void notesnap_common(FAR struct note_driver_s *drv,
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
note->cpu = tcb->cpu; note->cpu = tcb->cpu;
#endif #endif
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT note->count = perf_gettime();
note->count = up_perf_gettime();
#else
clock_systime_timespec(&note->time);
#endif
note->pid = tcb->pid; note->pid = tcb->pid;
note->args = args; note->args = args;
} }
@@ -379,14 +371,11 @@ void notesnap_dump_with_stream(FAR struct lib_outstream_s *stream)
{ {
size_t i; size_t i;
size_t index = g_notesnap.index % CONFIG_DRIVERS_NOTESNAP_NBUFFERS; size_t index = g_notesnap.index % CONFIG_DRIVERS_NOTESNAP_NBUFFERS;
clock_t lastcount = g_notesnap.buffer[index].count;
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT
uint32_t lastcount = g_notesnap.buffer[index].count;
struct timespec lasttime = struct timespec lasttime =
{ {
0 0
}; };
#endif
/* Stop recording while dumping */ /* Stop recording while dumping */
@@ -397,15 +386,13 @@ void notesnap_dump_with_stream(FAR struct lib_outstream_s *stream)
{ {
FAR struct notesnap_chunk_s *note = &g_notesnap.buffer[i]; FAR struct notesnap_chunk_s *note = &g_notesnap.buffer[i];
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT
struct timespec time; struct timespec time;
unsigned long elapsed = note->count < lastcount ? clock_t elapsed = note->count < lastcount ?
note->count + UINT32_MAX - lastcount : note->count + CLOCK_MAX - lastcount :
note->count - lastcount; note->count - lastcount;
up_perf_convert(elapsed, &time); perf_convert(elapsed, &time);
clock_timespec_add(&lasttime, &time, &lasttime); clock_timespec_add(&lasttime, &time, &lasttime);
lastcount = note->count; lastcount = note->count;
#endif
lib_sprintf(stream, lib_sprintf(stream,
"snapshoot: [%u.%09u] " "snapshoot: [%u.%09u] "
@@ -413,12 +400,8 @@ void notesnap_dump_with_stream(FAR struct lib_outstream_s *stream)
"[CPU%d] " "[CPU%d] "
#endif #endif
"[%d] %-16s %#" PRIxPTR "\n", "[%d] %-16s %#" PRIxPTR "\n",
#ifdef CONFIG_SCHED_INSTRUMENTATION_PERFCOUNT
(unsigned)lasttime.tv_sec, (unsigned)lasttime.tv_sec,
(unsigned)lasttime.tv_nsec, (unsigned)lasttime.tv_nsec,
#else
(unsigned)note->time.tv_sec, (unsigned)note->time.tv_nsec,
#endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
note->cpu, note->cpu,
#endif #endif
+8 -8
View File
@@ -28,6 +28,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <string.h> #include <string.h>
#include <sys/param.h> #include <sys/param.h>
#include <time.h>
#include "rptun.h" #include "rptun.h"
@@ -121,11 +122,11 @@ static int rptun_ping_once(FAR struct rpmsg_endpoint *ept,
return ret; return ret;
} }
static void rptun_ping_logout(FAR const char *s, unsigned long value) static void rptun_ping_logout(FAR const char *s, clock_t value)
{ {
struct timespec ts; struct timespec ts;
up_perf_convert(value, &ts); perf_convert(value, &ts);
#ifdef CONFIG_SYSTEM_TIME64 #ifdef CONFIG_SYSTEM_TIME64
syslog(LOG_INFO, "%s: s %" PRIu64 ", ns %ld\n", s, ts.tv_sec, ts.tv_nsec); syslog(LOG_INFO, "%s: s %" PRIu64 ", ns %ld\n", s, ts.tv_sec, ts.tv_nsec);
@@ -141,8 +142,8 @@ static void rptun_ping_logout(FAR const char *s, unsigned long value)
int rptun_ping(FAR struct rpmsg_endpoint *ept, int rptun_ping(FAR struct rpmsg_endpoint *ept,
FAR const struct rptun_ping_s *ping) FAR const struct rptun_ping_s *ping)
{ {
unsigned long min = ULONG_MAX; clock_t min = ULONG_MAX;
unsigned long max = 0; clock_t max = 0;
uint64_t total = 0; uint64_t total = 0;
int i; int i;
@@ -153,7 +154,7 @@ int rptun_ping(FAR struct rpmsg_endpoint *ept,
for (i = 0; i < ping->times; i++) for (i = 0; i < ping->times; i++)
{ {
unsigned long tm = up_perf_gettime(); clock_t tm = perf_gettime();
int ret = rptun_ping_once(ept, ping->len, ping->ack); int ret = rptun_ping_once(ept, ping->len, ping->ack);
if (ret < 0) if (ret < 0)
@@ -161,7 +162,7 @@ int rptun_ping(FAR struct rpmsg_endpoint *ept,
return ret; return ret;
} }
tm = up_perf_gettime() - tm; tm = perf_gettime() - tm;
min = MIN(min, tm); min = MIN(min, tm);
max = MAX(max, tm); max = MAX(max, tm);
total += tm; total += tm;
@@ -169,8 +170,7 @@ int rptun_ping(FAR struct rpmsg_endpoint *ept,
usleep(ping->sleep * USEC_PER_MSEC); usleep(ping->sleep * USEC_PER_MSEC);
} }
syslog(LOG_INFO, "current CPU freq: %lu, ping times: %d\n", syslog(LOG_INFO, "ping times: %d\n", ping->times);
up_perf_getfreq(), ping->times);
rptun_ping_logout("avg", total / ping->times); rptun_ping_logout("avg", total / ping->times);
rptun_ping_logout("min", min); rptun_ping_logout("min", min);
+2 -2
View File
@@ -350,7 +350,7 @@ unsigned int note_sysview_get_interrupt_id(void)
unsigned long note_sysview_get_timestamp(void) unsigned long note_sysview_get_timestamp(void)
{ {
return up_perf_gettime(); return perf_gettime();
} }
/**************************************************************************** /****************************************************************************
@@ -369,7 +369,7 @@ unsigned long note_sysview_get_timestamp(void)
int note_sysview_initialize(void) int note_sysview_initialize(void)
{ {
unsigned long freq = up_perf_getfreq(); unsigned long freq = perf_getfreq();
int ret; int ret;
static const SEGGER_SYSVIEW_OS_API g_sysview_trace_api = static const SEGGER_SYSVIEW_OS_API g_sysview_trace_api =
+2 -2
View File
@@ -191,7 +191,7 @@ static ssize_t critmon_read_cpu(FAR struct critmon_file_s *attr,
if (g_premp_max[cpu] > 0) if (g_premp_max[cpu] > 0)
{ {
up_perf_convert(g_premp_max[cpu], &maxtime); perf_convert(g_premp_max[cpu], &maxtime);
} }
else else
{ {
@@ -222,7 +222,7 @@ static ssize_t critmon_read_cpu(FAR struct critmon_file_s *attr,
if (g_crit_max[cpu] > 0) if (g_crit_max[cpu] > 0)
{ {
up_perf_convert(g_crit_max[cpu], &maxtime); perf_convert(g_crit_max[cpu], &maxtime);
} }
else else
{ {
+4 -4
View File
@@ -775,7 +775,7 @@ static ssize_t proc_critmon(FAR struct proc_file_s *procfile,
if (tcb->premp_max > 0) if (tcb->premp_max > 0)
{ {
up_perf_convert(tcb->premp_max, &maxtime); perf_convert(tcb->premp_max, &maxtime);
} }
else else
{ {
@@ -808,7 +808,7 @@ static ssize_t proc_critmon(FAR struct proc_file_s *procfile,
if (tcb->crit_max > 0) if (tcb->crit_max > 0)
{ {
up_perf_convert(tcb->crit_max, &maxtime); perf_convert(tcb->crit_max, &maxtime);
} }
else else
{ {
@@ -841,7 +841,7 @@ static ssize_t proc_critmon(FAR struct proc_file_s *procfile,
if (tcb->run_max > 0) if (tcb->run_max > 0)
{ {
up_perf_convert(tcb->run_max, &maxtime); perf_convert(tcb->run_max, &maxtime);
} }
else else
{ {
@@ -852,7 +852,7 @@ static ssize_t proc_critmon(FAR struct proc_file_s *procfile,
/* Reset the maximum */ /* Reset the maximum */
tcb->run_max = 0; tcb->run_max = 0;
up_perf_convert(tcb->run_time, &runtime); perf_convert(tcb->run_time, &runtime);
/* Output the maximum time the thread has run and /* Output the maximum time the thread has run and
* the total time the thread has run * the total time the thread has run
+6
View File
@@ -232,6 +232,12 @@
#define TIMER_MAX _POSIX_TIMER_MAX #define TIMER_MAX _POSIX_TIMER_MAX
#define CLOCKRES_MIN _POSIX_CLOCKRES_MIN #define CLOCKRES_MIN _POSIX_CLOCKRES_MIN
#ifdef CONFIG_SYSTEM_TIME64
# define CLOCK_MAX UINT64_MAX
#else
# define CLOCK_MAX UINT32_MAX
#endif
/* Other invariant values */ /* Other invariant values */
/* CHARCLASS_NAME_MAX /* CHARCLASS_NAME_MAX
+9 -9
View File
@@ -631,13 +631,13 @@ struct tcb_s
/* Pre-emption monitor support ********************************************/ /* Pre-emption monitor support ********************************************/
#ifdef CONFIG_SCHED_CRITMONITOR #ifdef CONFIG_SCHED_CRITMONITOR
unsigned long premp_start; /* Time when preemption disabled */ clock_t premp_start; /* Time when preemption disabled */
unsigned long premp_max; /* Max time preemption disabled */ clock_t premp_max; /* Max time preemption disabled */
unsigned long crit_start; /* Time critical section entered */ clock_t crit_start; /* Time critical section entered */
unsigned long crit_max; /* Max time in critical section */ clock_t crit_max; /* Max time in critical section */
unsigned long run_start; /* Time when thread begin run */ clock_t run_start; /* Time when thread begin run */
unsigned long run_max; /* Max time thread run */ clock_t run_max; /* Max time thread run */
unsigned long run_time; /* Total time thread run */ clock_t run_time; /* Total time thread run */
#endif #endif
/* State save areas *******************************************************/ /* State save areas *******************************************************/
@@ -762,8 +762,8 @@ extern "C"
#ifdef CONFIG_SCHED_CRITMONITOR #ifdef CONFIG_SCHED_CRITMONITOR
/* Maximum time with pre-emption disabled or within critical section. */ /* Maximum time with pre-emption disabled or within critical section. */
EXTERN unsigned long g_premp_max[CONFIG_SMP_NCPUS]; EXTERN clock_t g_premp_max[CONFIG_SMP_NCPUS];
EXTERN unsigned long g_crit_max[CONFIG_SMP_NCPUS]; EXTERN clock_t g_crit_max[CONFIG_SMP_NCPUS];
#endif /* CONFIG_SCHED_CRITMONITOR */ #endif /* CONFIG_SCHED_CRITMONITOR */
EXTERN const struct tcbinfo_s g_tcbinfo; EXTERN const struct tcbinfo_s g_tcbinfo;
-8
View File
@@ -1080,14 +1080,6 @@ config SCHED_INSTRUMENTATION_CPUSET
---help--- ---help---
Monitor only CPUs in the bitset. Bit 0=CPU0, Bit1=CPU1, etc. Monitor only CPUs in the bitset. Bit 0=CPU0, Bit1=CPU1, etc.
config SCHED_INSTRUMENTATION_PERFCOUNT
bool "Use perf count for instrumentation"
default n
---help---
Enabling this option will use perfcount as the clock source for tv_nsec
to achieve higher precision time.
This requires calling up_perf_init at system startup.
config SCHED_INSTRUMENTATION_FILTER config SCHED_INSTRUMENTATION_FILTER
bool "Instrumentation filter" bool "Instrumentation filter"
default n default n
+2 -2
View File
@@ -155,7 +155,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
if (tcb != NULL) if (tcb != NULL)
{ {
up_perf_convert(tcb->run_time, tp); perf_convert(tcb->run_time, tp);
} }
else else
{ {
@@ -197,7 +197,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
} }
leave_critical_section(flags); leave_critical_section(flags);
up_perf_convert(runtime, tp); perf_convert(runtime, tp);
} }
else else
{ {
+2 -7
View File
@@ -60,13 +60,8 @@ struct irq_info_s
FAR void *arg; /* The argument provided to the interrupt handler. */ FAR void *arg; /* The argument provided to the interrupt handler. */
#ifdef CONFIG_SCHED_IRQMONITOR #ifdef CONFIG_SCHED_IRQMONITOR
clock_t start; /* Time interrupt attached */ clock_t start; /* Time interrupt attached */
#ifdef CONFIG_HAVE_LONG_LONG clock_t time; /* Maximum execution time on this IRQ */
uint64_t count; /* Number of interrupts on this IRQ */ uint32_t count; /* Number of interrupts on this IRQ */
#else
uint32_t mscount; /* Number of interrupts on this IRQ (MS) */
uint32_t lscount; /* Number of interrupts on this IRQ (LS) */
#endif
uint32_t time; /* Maximum execution time on this IRQ */
#endif #endif
}; };
+1 -5
View File
@@ -117,12 +117,8 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg)
g_irqvector[ndx].arg = arg; g_irqvector[ndx].arg = arg;
#ifdef CONFIG_SCHED_IRQMONITOR #ifdef CONFIG_SCHED_IRQMONITOR
g_irqvector[ndx].start = clock_systime_ticks(); g_irqvector[ndx].start = clock_systime_ticks();
#ifdef CONFIG_HAVE_LONG_LONG g_irqvector[ndx].time = 0;
g_irqvector[ndx].count = 0; g_irqvector[ndx].count = 0;
#else
g_irqvector[ndx].mscount = 0;
g_irqvector[ndx].lscount = 0;
#endif
#endif #endif
leave_critical_section(flags); leave_critical_section(flags);
+7 -30
View File
@@ -45,29 +45,6 @@
# define NUSER_IRQS NR_IRQS # define NUSER_IRQS NR_IRQS
#endif #endif
/* INCR_COUNT - Increment the count of interrupts taken on this IRQ number */
#ifndef CONFIG_SCHED_IRQMONITOR
# define INCR_COUNT(ndx)
#elif defined(CONFIG_HAVE_LONG_LONG)
# define INCR_COUNT(ndx) \
do \
{ \
g_irqvector[ndx].count++; \
} \
while (0)
#else
# define INCR_COUNT(ndx) \
do \
{ \
if (++g_irqvector[ndx].lscount == 0) \
{ \
g_irqvector[ndx].mscount++; \
} \
} \
while (0)
#endif
/* CALL_VECTOR - Call the interrupt service routine attached to this /* CALL_VECTOR - Call the interrupt service routine attached to this
* interrupt request * interrupt request
*/ */
@@ -80,14 +57,14 @@
# define CALL_VECTOR(ndx, vector, irq, context, arg) \ # define CALL_VECTOR(ndx, vector, irq, context, arg) \
do \ do \
{ \ { \
unsigned long start; \ clock_t start; \
unsigned long elapsed; \ clock_t elapsed; \
start = up_perf_gettime(); \ start = perf_gettime(); \
vector(irq, context, arg); \ vector(irq, context, arg); \
elapsed = up_perf_gettime() - start; \ elapsed = perf_gettime() - start; \
if (ndx < NUSER_IRQS) \ if (ndx < NUSER_IRQS) \
{ \ { \
INCR_COUNT(ndx); \ g_irqvector[ndx].count++; \
if (elapsed > g_irqvector[ndx].time) \ if (elapsed > g_irqvector[ndx].time) \
{ \ { \
g_irqvector[ndx].time = elapsed; \ g_irqvector[ndx].time = elapsed; \
@@ -96,8 +73,8 @@
if (CONFIG_SCHED_CRITMONITOR_MAXTIME_IRQ > 0 && \ if (CONFIG_SCHED_CRITMONITOR_MAXTIME_IRQ > 0 && \
elapsed > CONFIG_SCHED_CRITMONITOR_MAXTIME_IRQ) \ elapsed > CONFIG_SCHED_CRITMONITOR_MAXTIME_IRQ) \
{ \ { \
CRITMONITOR_PANIC("IRQ %d(%p), execute time too long %lu\n", \ CRITMONITOR_PANIC("IRQ %d(%p), execute time too long %ju\n", \
irq, vector, elapsed); \ irq, vector, (uintmax_t)elapsed); \
} \ } \
} \ } \
while (0) while (0)
+5 -10
View File
@@ -159,15 +159,10 @@ static int irq_callback(int irq, FAR struct irq_info_s *info,
flags = enter_critical_section(); flags = enter_critical_section();
memcpy(&copy, info, sizeof(struct irq_info_s)); memcpy(&copy, info, sizeof(struct irq_info_s));
now = clock_systime_ticks(); now = clock_systime_ticks();
info->start = now; info->start = now;
#ifdef CONFIG_HAVE_LONG_LONG info->time = 0;
info->count = 0; info->count = 0;
#else
info->mscount = 0;
info->lscount = 0;
#endif
info->time = 0;
leave_critical_section(flags); leave_critical_section(flags);
/* Don't bother if count == 0. /* Don't bother if count == 0.
@@ -201,7 +196,7 @@ static int irq_callback(int irq, FAR struct irq_info_s *info,
*/ */
elapsed = now - copy.start; elapsed = now - copy.start;
up_perf_convert(copy.time, &delta); perf_convert(copy.time, &delta);
#ifdef CONFIG_HAVE_LONG_LONG #ifdef CONFIG_HAVE_LONG_LONG
/* elapsed = <current-time> - <start-time>, units=clock ticks /* elapsed = <current-time> - <start-time>, units=clock ticks
+16 -15
View File
@@ -28,6 +28,7 @@
#include <sched.h> #include <sched.h>
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <time.h>
#include "sched/sched.h" #include "sched/sched.h"
@@ -103,8 +104,8 @@
/* Start time when pre-emption disabled or critical section entered. */ /* Start time when pre-emption disabled or critical section entered. */
static unsigned long g_premp_start[CONFIG_SMP_NCPUS]; static clock_t g_premp_start[CONFIG_SMP_NCPUS];
static unsigned long g_crit_start[CONFIG_SMP_NCPUS]; static clock_t g_crit_start[CONFIG_SMP_NCPUS];
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@@ -112,8 +113,8 @@ static unsigned long g_crit_start[CONFIG_SMP_NCPUS];
/* Maximum time with pre-emption disabled or within critical section. */ /* Maximum time with pre-emption disabled or within critical section. */
unsigned long g_premp_max[CONFIG_SMP_NCPUS]; clock_t g_premp_max[CONFIG_SMP_NCPUS];
unsigned long g_crit_max[CONFIG_SMP_NCPUS]; clock_t g_crit_max[CONFIG_SMP_NCPUS];
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -141,15 +142,15 @@ void nxsched_critmon_preemption(FAR struct tcb_s *tcb, bool state)
{ {
/* Disabling.. Save the thread start time */ /* Disabling.. Save the thread start time */
tcb->premp_start = up_perf_gettime(); tcb->premp_start = perf_gettime();
g_premp_start[cpu] = tcb->premp_start; g_premp_start[cpu] = tcb->premp_start;
} }
else else
{ {
/* Re-enabling.. Check for the max elapsed time */ /* Re-enabling.. Check for the max elapsed time */
unsigned long now = up_perf_gettime(); clock_t now = perf_gettime();
unsigned long elapsed = now - tcb->premp_start; clock_t elapsed = now - tcb->premp_start;
if (elapsed > tcb->premp_max) if (elapsed > tcb->premp_max)
{ {
@@ -189,15 +190,15 @@ void nxsched_critmon_csection(FAR struct tcb_s *tcb, bool state)
{ {
/* Entering... Save the start time. */ /* Entering... Save the start time. */
tcb->crit_start = up_perf_gettime(); tcb->crit_start = perf_gettime();
g_crit_start[cpu] = tcb->crit_start; g_crit_start[cpu] = tcb->crit_start;
} }
else else
{ {
/* Leaving .. Check for the max elapsed time */ /* Leaving .. Check for the max elapsed time */
unsigned long now = up_perf_gettime(); clock_t now = perf_gettime();
unsigned long elapsed = now - tcb->crit_start; clock_t elapsed = now - tcb->crit_start;
if (elapsed > tcb->crit_max) if (elapsed > tcb->crit_max)
{ {
@@ -230,9 +231,9 @@ void nxsched_critmon_csection(FAR struct tcb_s *tcb, bool state)
void nxsched_resume_critmon(FAR struct tcb_s *tcb) void nxsched_resume_critmon(FAR struct tcb_s *tcb)
{ {
unsigned long current = up_perf_gettime(); clock_t current = perf_gettime();
int cpu = this_cpu(); int cpu = this_cpu();
unsigned long elapsed; clock_t elapsed;
tcb->run_start = current; tcb->run_start = current;
@@ -294,11 +295,11 @@ void nxsched_resume_critmon(FAR struct tcb_s *tcb)
void nxsched_suspend_critmon(FAR struct tcb_s *tcb) void nxsched_suspend_critmon(FAR struct tcb_s *tcb)
{ {
unsigned long current = up_perf_gettime(); clock_t current = perf_gettime();
unsigned long elapsed = current - tcb->run_start; clock_t elapsed = current - tcb->run_start;
#ifdef CONFIG_SCHED_CPULOAD_CRITMONITOR #ifdef CONFIG_SCHED_CPULOAD_CRITMONITOR
unsigned long tick = elapsed * CLOCKS_PER_SEC / up_perf_getfreq(); clock_t tick = elapsed * CLOCKS_PER_SEC / perf_getfreq();
nxsched_process_taskload_ticks(tcb, tick); nxsched_process_taskload_ticks(tcb, tick);
#endif #endif
+6 -6
View File
@@ -52,16 +52,16 @@
# define CALL_FUNC(func, arg) \ # define CALL_FUNC(func, arg) \
do \ do \
{ \ { \
unsigned long start; \ clock_t start; \
unsigned long elapsed; \ clock_t elapsed; \
start = up_perf_gettime(); \ start = perf_gettime(); \
func(arg); \ func(arg); \
elapsed = up_perf_gettime() - start; \ elapsed = perf_gettime() - start; \
if (elapsed > CONFIG_SCHED_CRITMONITOR_MAXTIME_WDOG) \ if (elapsed > CONFIG_SCHED_CRITMONITOR_MAXTIME_WDOG) \
{ \ { \
CRITMONITOR_PANIC("WDOG %p, %s IRQ, execute too long %lu\n", \ CRITMONITOR_PANIC("WDOG %p, %s IRQ, execute too long %ju\n", \
func, up_interrupt_context() ? \ func, up_interrupt_context() ? \
"IN" : "NOT", elapsed); \ "IN" : "NOT", (uintmax_t)elapsed); \
} \ } \
} \ } \
while (0) while (0)
+6 -6
View File
@@ -55,15 +55,15 @@
# define CALL_WORKER(worker, arg) \ # define CALL_WORKER(worker, arg) \
do \ do \
{ \ { \
unsigned long start; \ clock_t start; \
unsigned long elapsed; \ clock_t elapsed; \
start = up_perf_gettime(); \ start = perf_gettime(); \
worker(arg); \ worker(arg); \
elapsed = up_perf_gettime() - start; \ elapsed = perf_gettime() - start; \
if (elapsed > CONFIG_SCHED_CRITMONITOR_MAXTIME_WQUEUE) \ if (elapsed > CONFIG_SCHED_CRITMONITOR_MAXTIME_WQUEUE) \
{ \ { \
CRITMONITOR_PANIC("WORKER %p execute too long %lu\n", \ CRITMONITOR_PANIC("WORKER %p execute too long %ju\n", \
worker, elapsed); \ worker, (uintmax_t)elapsed); \
} \ } \
} \ } \
while (0) while (0)