diff --git a/fs/procfs/fs_procfscritmon.c b/fs/procfs/fs_procfscritmon.c index 37b01635ddb..dba566dfd46 100644 --- a/fs/procfs/fs_procfscritmon.c +++ b/fs/procfs/fs_procfscritmon.c @@ -85,17 +85,6 @@ struct critmon_file_s char line[CRITMON_LINELEN]; /* Pre-allocated buffer for formatted lines */ }; -/**************************************************************************** - * External Function Prototypes - ****************************************************************************/ - -/* If CONFIG_SCHED_CRITMONITOR is selected, then platform-specific logic - * must provide the following interface. This function converts platform- - * specific elapsed time into a well-known time format. - */ - -void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts); - /**************************************************************************** * Private Function Prototypes ****************************************************************************/ diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index 5e7293c1e64..28d980fcd3e 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -174,20 +174,6 @@ static FAR const char *g_policy[4] = "SCHED_FIFO", "SCHED_RR", "SCHED_SPORADIC", "SCHED_OTHER" }; -/**************************************************************************** - * External Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_SCHED_CRITMONITOR -/* If CONFIG_SCHED_CRITMONITOR is selected, then platform-specific logic - * must provide the following interface. This interface simply converts an - * elapsed time into well known units for presentation by the ProcFS file - * system.. - */ - -void up_critmon_convert(uint32_t starttime, FAR struct timespec *ts); -#endif - /**************************************************************************** * Private Function Prototypes ****************************************************************************/ diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 4d15347cd35..e80e4a25700 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -2400,6 +2400,30 @@ void arch_sporadic_suspend(FAR struct tcb_s *tcb); void arch_sporadic_resume(FAR struct tcb_s *tcb); #endif +/******************************************************************************** + * Name: up_critmon_* + * + * Description: + * The first interface simply provides the current time value in unknown + * units. NOTE: This function may be called early before the timer has + * been initialized. In that event, the function should just return a + * start time of zero. + * + * Nothing is assumed about the units of this time value. The following + * are assumed, however: (1) The time is an unsigned integer value, (2) + * the time is monotonically increasing, and (3) the elapsed time (also + * in unknown units) can be obtained by subtracting a start time from + * the current time. + * + * The second interface simple converts an elapsed time into well known + * units. + ********************************************************************************/ + +#ifdef CONFIG_SCHED_CRITMONITOR +uint32_t up_critmon_gettime(void); +void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/sched/Kconfig b/sched/Kconfig index 1eeb38d23b7..36e4701ef16 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -724,38 +724,6 @@ config SCHED_IRQMONITOR counts will be available in the mounted procfs file systems at the top-level file, "irqs". -config SCHED_IRQMONITOR_GETTIME - bool "Custom Platform-specific Timer" - default n - depends on SCHED_IRQMONITOR && SCHED_TICKLESS && !SCHED_CRITMONITOR - ---help--- - If CONFIG_SCHED_TICKLESS is enabled, then the high resolution - Tickless timer will be used by default. Otherwise, a platform- - specific timer is expected (the same timer used with the Critical - Section Monitor). The option will force use of that platform- - specifier timer even the CONFIG_SCHED_TICKLESs is defined. - - if CONFIG_SCHED_TICKLESS is not enabled or CONFIG_SCHED_IRQMONITOR_GETTIME - is selected, then platform-specific logic must provide the following in - order to support high resolution timing: - - uint32_t up_critmon_gettime(void); - void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts); - - The first interface simply provides the current time value in unknown - units. NOTE: This function may be called early before the timer has - been initialized. In that event, the function should just return a - start time of zero. - - Nothing is assumed about the units of this time value. The following - are assumed, however: (1) The time is an unsigned integer value, (2) - the time is monotonically increasing, and (3) the elapsed time (also - in unknown units) can be obtained by subtracting a start time from - the current time. - - The second interface simple converts an elapsed time into well known - units for presentation by the ProcFS file system. - config SCHED_CRITMONITOR bool "Enable Critical Section monitoring" default n diff --git a/sched/irq/irq_dispatch.c b/sched/irq/irq_dispatch.c index 13ce6bd9ae5..1e85e355b12 100644 --- a/sched/irq/irq_dispatch.c +++ b/sched/irq/irq_dispatch.c @@ -54,43 +54,35 @@ /* INCR_COUNT - Increment the count of interrupts taken on this IRQ number */ -#ifdef CONFIG_SCHED_IRQMONITOR -# ifdef 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 -#else +#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 interrupt * request */ -#undef HAVE_PLATFORM_GETTIME -#if defined(CONFIG_SCHED_IRQMONITOR) && \ - (!defined(CONFIG_SCHED_TICKLESS) || \ - defined(CONFIG_SCHED_CRITMONITOR) || \ - defined(CONFIG_SCHED_IRQMONITOR_GETTIME)) -# define HAVE_PLATFORM_GETTIME 1 -#endif - -#ifdef CONFIG_SCHED_IRQMONITOR -#ifdef HAVE_PLATFORM_GETTIME +#ifndef CONFIG_SCHED_IRQMONITOR +# define CALL_VECTOR(ndx, vector, irq, context, arg) \ + vector(irq, context, arg) +#elif defined(CONFIG_SCHED_CRITMONITOR) # define CALL_VECTOR(ndx, vector, irq, context, arg) \ do \ { \ @@ -124,41 +116,8 @@ } \ } \ while (0) -#endif /* HAVE_PLATFORM_GETTIME */ -#else -# define CALL_VECTOR(ndx, vector, irq, context, arg) \ - vector(irq, context, arg) #endif /* CONFIG_SCHED_IRQMONITOR */ -/**************************************************************************** - * External Function Prototypes - ****************************************************************************/ - -#ifdef HAVE_PLATFORM_GETTIME -/* If CONFIG_SCHED_TICKLESS is enabled, then the high resolution Tickless - * timer will be used. Otherwise, the platform specific logic must provide - * the following in order to support high resolution timing: - */ - -uint32_t up_critmon_gettime(void); -void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts); - -/* The first interface simply provides the current time value in unknown - * units. NOTE: This function may be called early before the timer has - * been initialized. In that event, the function should just return a - * start time of zero. - * - * Nothing is assumed about the units of this time value. The following - * are assumed, however: (1) The time is an unsigned integer value, (2) - * the time is monotonically increasing, and (3) the elapsed time (also - * in unknown units) can be obtained by subtracting a start time from - * the current time. - * - * The second interface simple converts an elapsed time into well known - * units. - */ -#endif /* HAVE_PLATFORM_GETTIME */ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/sched/sched/sched_critmonitor.c b/sched/sched/sched_critmonitor.c index cc17d0eb612..933756388e9 100644 --- a/sched/sched/sched_critmonitor.c +++ b/sched/sched/sched_critmonitor.c @@ -46,25 +46,6 @@ #ifdef CONFIG_SCHED_CRITMONITOR -/**************************************************************************** - * External Function Prototypes - ****************************************************************************/ - -/* If CONFIG_SCHED_CRITMONITOR is selected, then platform-specific logic - * must provide the following interface. This interface simply provides the - * current time value in unknown units. NOTE: This function may be called - * early before the timer has been initialized. In that event, the function - * should just return a start time of zero. - * - * Nothing is assumed about the units of this time value. The following - * are assumed, however: (1) The time is an unsigned is an unsigned integer - * value, (2) is is monotonically increasing, and (3) the elapsed time - * (also in unknown units) can be obtained by subtracting a start time - * from the current time. - */ - -uint32_t up_critmon_gettime(void); - /************************************************************************************ * Private Data ************************************************************************************/