cpuload: change cpuload type to clock_t

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2023-12-29 14:31:27 +08:00
committed by Xiang Xiao
parent 3521e6ba27
commit fd2da7f4bc
5 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -203,8 +203,8 @@ static ssize_t cpuload_read(FAR struct file *filep, FAR char *buffer,
if (filep->f_pos == 0) if (filep->f_pos == 0)
{ {
uint32_t total = 0; clock_t total = 0;
uint32_t active = 0; clock_t active = 0;
uint32_t intpart; uint32_t intpart;
uint32_t fracpart; uint32_t fracpart;
+2 -2
View File
@@ -277,8 +277,8 @@
#ifndef CONFIG_SCHED_CPULOAD_NONE #ifndef CONFIG_SCHED_CPULOAD_NONE
struct cpuload_s struct cpuload_s
{ {
volatile uint32_t total; /* Total number of clock ticks */ volatile clock_t total; /* Total number of clock ticks */
volatile uint32_t active; /* Number of ticks while this thread was active */ volatile clock_t active; /* Number of ticks while this thread was active */
}; };
#endif #endif
+1 -1
View File
@@ -623,7 +623,7 @@ struct tcb_s
/* CPU load monitoring support ********************************************/ /* CPU load monitoring support ********************************************/
#ifndef CONFIG_SCHED_CPULOAD_NONE #ifndef CONFIG_SCHED_CPULOAD_NONE
uint32_t ticks; /* Number of ticks on this thread */ clock_t ticks; /* Number of ticks on this thread */
#endif #endif
/* Pre-emption monitor support ********************************************/ /* Pre-emption monitor support ********************************************/
+3 -3
View File
@@ -240,7 +240,7 @@ extern const struct tasklist_s g_tasklisttable[NUM_TASK_STATES];
* 'denominator' for all CPU load calculations. * 'denominator' for all CPU load calculations.
*/ */
extern volatile uint32_t g_cpuload_total; extern volatile clock_t g_cpuload_total;
#endif #endif
/* Declared in sched_lock.c *************************************************/ /* Declared in sched_lock.c *************************************************/
@@ -399,8 +399,8 @@ int nxsched_pause_cpu(FAR struct tcb_s *tcb);
#if defined(CONFIG_SCHED_CPULOAD_SYSCLK) || \ #if defined(CONFIG_SCHED_CPULOAD_SYSCLK) || \
defined (CONFIG_SCHED_CPULOAD_CRITMONITOR) defined (CONFIG_SCHED_CPULOAD_CRITMONITOR)
void nxsched_process_taskload_ticks(FAR struct tcb_s *tcb, uint32_t ticks); void nxsched_process_taskload_ticks(FAR struct tcb_s *tcb, clock_t ticks);
void nxsched_process_cpuload_ticks(uint32_t ticks); void nxsched_process_cpuload_ticks(clock_t ticks);
#define nxsched_process_cpuload() nxsched_process_cpuload_ticks(1) #define nxsched_process_cpuload() nxsched_process_cpuload_ticks(1)
#endif #endif
+3 -3
View File
@@ -76,7 +76,7 @@
* each would have a load of 25% of the total. * each would have a load of 25% of the total.
*/ */
volatile uint32_t g_cpuload_total; volatile clock_t g_cpuload_total;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -97,7 +97,7 @@ volatile uint32_t g_cpuload_total;
* *
****************************************************************************/ ****************************************************************************/
void nxsched_process_taskload_ticks(FAR struct tcb_s *tcb, uint32_t ticks) void nxsched_process_taskload_ticks(FAR struct tcb_s *tcb, clock_t ticks)
{ {
tcb->ticks += ticks; tcb->ticks += ticks;
g_cpuload_total += ticks; g_cpuload_total += ticks;
@@ -147,7 +147,7 @@ void nxsched_process_taskload_ticks(FAR struct tcb_s *tcb, uint32_t ticks)
* *
****************************************************************************/ ****************************************************************************/
void nxsched_process_cpuload_ticks(uint32_t ticks) void nxsched_process_cpuload_ticks(clock_t ticks)
{ {
int i; int i;