mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 00:27:10 +08:00
sched/spinlock: Update the information of critmon in docu.
Since the busy-wait time statistics for entering the critical section have been added, the critmon information in the document has been updated accordingly. Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
This commit is contained in:
@@ -257,6 +257,14 @@ and preemption operations. Only have instructions when scheduler triggers contex
|
||||
* >= 0 to enable critical section entered time statistic, data will be in critmon procfs.
|
||||
* > 0 to also do alert log when critical section entered time above the configuration ticks.
|
||||
|
||||
**Critical section pre-entry busywait time**::
|
||||
|
||||
CONFIG_SCHED_CRITMONITOR_MAXTIME_BUSYWAIT=-1
|
||||
|
||||
* Default -1 to disable critical section pre-entry busywait time statistic.
|
||||
* >= 0 to enable critical section pre-entry busywait time statistic, data will be in critmon procfs.
|
||||
* > 0 to also do alert log when critical section pre-entry busywait time above the configuration ticks.
|
||||
|
||||
**Irq executing time**::
|
||||
|
||||
CONFIG_SCHED_CRITMONITOR_MAXTIME_IRQ=-1
|
||||
|
||||
@@ -191,7 +191,7 @@ static ssize_t critmon_read_cpu(FAR struct critmon_file_s *attr,
|
||||
size_t copysize;
|
||||
size_t totalsize;
|
||||
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_BUSYWAIT >= 0
|
||||
struct timespec alltime;
|
||||
struct timespec all_time;
|
||||
clock_t elapsed;
|
||||
uint32_t rate;
|
||||
#endif
|
||||
@@ -321,24 +321,24 @@ static ssize_t critmon_read_cpu(FAR struct critmon_file_s *attr,
|
||||
|
||||
if (g_busywait_total[cpu] > 0)
|
||||
{
|
||||
perf_convert(g_busywait_total[cpu], &alltime);
|
||||
perf_convert(g_busywait_total[cpu], &all_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
alltime.tv_sec = 0;
|
||||
alltime.tv_nsec = 0;
|
||||
all_time.tv_sec = 0;
|
||||
all_time.tv_nsec = 0;
|
||||
}
|
||||
|
||||
elapsed = clock() * CONFIG_USEC_PER_TICK;
|
||||
rate = (uint64_t)(alltime.tv_sec * 1000000 + alltime.tv_nsec / 1000) *
|
||||
rate = (uint64_t)(all_time.tv_sec * 1000000 + all_time.tv_nsec / 1000) *
|
||||
1000000 / elapsed;
|
||||
|
||||
/* Generate output for all busywait time to enter csection(get spinlock) */
|
||||
|
||||
linesize = procfs_snprintf(attr->line, CRITMON_LINELEN, ",%lu.%09lu %2"
|
||||
PRId32 ".%04" PRId32 "%%",
|
||||
(unsigned long)alltime.tv_sec,
|
||||
(unsigned long)alltime.tv_nsec,
|
||||
(unsigned long)all_time.tv_sec,
|
||||
(unsigned long)all_time.tv_nsec,
|
||||
rate / 10000, rate % 10000);
|
||||
copysize = procfs_memcpy(attr->line, linesize, buffer, buflen, offset);
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ irqstate_t enter_critical_section_notrace(void)
|
||||
#endif
|
||||
|
||||
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0 || \
|
||||
CONFIG_SCHED_CRITMONITOR_MAXTIME_BUSYWAIT >= 0 || \
|
||||
defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION)
|
||||
irqstate_t enter_critical_section(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user