Squashed commit of the following:

fs/procfs/fs_procfsproc:  Extended the process ID ProcFS output to show per-thread maximum time for pre-emption disabled and maximum time within a critical section.

    sched/sched/sched_critmonitor.c:  Adds data collection logic in support of monitoring critical sections and pre-emption state.
This commit is contained in:
Gregory Nutt
2018-11-24 10:32:45 -06:00
parent 6d9103b01a
commit fc6084f311
13 changed files with 521 additions and 30 deletions
+6 -3
View File
@@ -1,7 +1,8 @@
/****************************************************************************
* include/nuttx/irq.h
*
* Copyright (C) 2007-2011, 2013, 2016-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2011, 2013, 2016-2017 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -196,7 +197,8 @@ int irqchain_detach(int irq, xcpt_t isr, FAR void *arg);
*
****************************************************************************/
#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION)
#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION) || \
defined(CONFIG_SCHED_CRITMONITOR)
irqstate_t enter_critical_section(void);
#else
# define enter_critical_section(f) up_irq_save(f)
@@ -223,7 +225,8 @@ irqstate_t enter_critical_section(void);
*
****************************************************************************/
#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION)
#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION) || \
defined(CONFIG_SCHED_CRITMONITOR)
void leave_critical_section(irqstate_t flags);
#else
# define leave_critical_section(f) up_irq_restore(f)
+14 -2
View File
@@ -696,6 +696,16 @@ struct tcb_s
FAR void *pthread_data[CONFIG_NPTHREAD_KEYS];
#endif
/* Pre-emption monitor support ************************************************/
#ifdef CONFIG_SCHED_CRITMONITOR
uint32_t crit_flags; /* Flag values used by the monitor */
uint32_t premp_start; /* Time when preemption disabled */
uint32_t premp_max; /* Max time preemption disabled */
uint32_t crit_start; /* Time critical section entered */
uint32_t crit_max; /* Max time in critical section */
#endif
/* Library related fields *****************************************************/
int pterrno; /* Current per-thread errno */
@@ -931,7 +941,8 @@ int group_exitinfo(pid_t pid, FAR struct binary_s *bininfo);
********************************************************************************/
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) || \
defined(CONFIG_SCHED_INSTRUMENTATION) || defined(CONFIG_SMP)
defined(CONFIG_SCHED_INSTRUMENTATION) || defined(CONFIG_SCHED_CRITMONITOR) || \
defined(CONFIG_SMP)
void sched_resume_scheduler(FAR struct tcb_s *tcb);
#else
# define sched_resume_scheduler(tcb)
@@ -953,7 +964,8 @@ void sched_resume_scheduler(FAR struct tcb_s *tcb);
*
********************************************************************************/
#if defined(CONFIG_SCHED_SPORADIC) || defined(CONFIG_SCHED_INSTRUMENTATION)
#if defined(CONFIG_SCHED_SPORADIC) || defined(CONFIG_SCHED_INSTRUMENTATION) || \
defined(CONFIG_SCHED_CRITMONITOR)
void sched_suspend_scheduler(FAR struct tcb_s *tcb);
#else
# define sched_suspend_scheduler(tcb)