REORG: sched: moved samp_time and idle_time to task.c as well

The idle time calculation stuff was moved to task.h by commit 6dfab112e
("REORG: sched: move idle time calculation from time.h to task.h") but
these two variables that are only maintained by task.{c,h} were still
left in time.{c,h}. They have to move as well.
This commit is contained in:
Willy Tarreau 2021-10-06 15:58:46 +02:00
parent 99ea188c0e
commit 078c2573c2
4 changed files with 8 additions and 6 deletions

View File

@ -90,6 +90,10 @@
extern volatile unsigned long global_tasks_mask; /* Mask of threads with tasks in the global runqueue */ extern volatile unsigned long global_tasks_mask; /* Mask of threads with tasks in the global runqueue */
extern unsigned int grq_total; /* total number of entries in the global run queue, atomic */ extern unsigned int grq_total; /* total number of entries in the global run queue, atomic */
extern unsigned int niced_tasks; /* number of niced tasks in the run queue */ extern unsigned int niced_tasks; /* number of niced tasks in the run queue */
extern THREAD_LOCAL unsigned int samp_time; /* total elapsed time over current sample */
extern THREAD_LOCAL unsigned int idle_time; /* total idle time over current sample */
extern struct pool_head *pool_head_task; extern struct pool_head *pool_head_task;
extern struct pool_head *pool_head_tasklet; extern struct pool_head *pool_head_tasklet;
extern struct pool_head *pool_head_notification; extern struct pool_head *pool_head_notification;

View File

@ -50,8 +50,6 @@
#define SETNOW(a) (*a=now) #define SETNOW(a) (*a=now)
extern THREAD_LOCAL unsigned int now_ms; /* internal date in milliseconds (may wrap) */ extern THREAD_LOCAL unsigned int now_ms; /* internal date in milliseconds (may wrap) */
extern THREAD_LOCAL unsigned int samp_time; /* total elapsed time over current sample */
extern THREAD_LOCAL unsigned int idle_time; /* total idle time over current sample */
extern THREAD_LOCAL struct timeval now; /* internal date is a monotonic function of real clock */ extern THREAD_LOCAL struct timeval now; /* internal date is a monotonic function of real clock */
extern THREAD_LOCAL struct timeval date; /* the real current date */ extern THREAD_LOCAL struct timeval date; /* the real current date */
extern struct timeval start_date; /* the process's start date */ extern struct timeval start_date; /* the process's start date */

View File

@ -37,6 +37,10 @@ DECLARE_POOL(pool_head_notification, "notification", sizeof(struct notification)
volatile unsigned long global_tasks_mask = 0; /* Mask of threads with tasks in the global runqueue */ volatile unsigned long global_tasks_mask = 0; /* Mask of threads with tasks in the global runqueue */
unsigned int niced_tasks = 0; /* number of niced tasks in the run queue */ unsigned int niced_tasks = 0; /* number of niced tasks in the run queue */
/* used for idle time calculation */
THREAD_LOCAL unsigned int samp_time = 0; /* total elapsed time over current sample */
THREAD_LOCAL unsigned int idle_time = 0; /* total idle time over current sample */
THREAD_LOCAL struct task_per_thread *sched = &task_per_thread[0]; /* scheduler context for the current thread */ THREAD_LOCAL struct task_per_thread *sched = &task_per_thread[0]; /* scheduler context for the current thread */
__decl_aligned_spinlock(rq_lock); /* spin lock related to run queue */ __decl_aligned_spinlock(rq_lock); /* spin lock related to run queue */

View File

@ -19,8 +19,6 @@
#include <haproxy/tools.h> #include <haproxy/tools.h>
THREAD_LOCAL unsigned int now_ms; /* internal date in milliseconds (may wrap) */ THREAD_LOCAL unsigned int now_ms; /* internal date in milliseconds (may wrap) */
THREAD_LOCAL unsigned int samp_time; /* total elapsed time over current sample */
THREAD_LOCAL unsigned int idle_time; /* total idle time over current sample */
THREAD_LOCAL struct timeval now; /* internal date is a monotonic function of real clock */ THREAD_LOCAL struct timeval now; /* internal date is a monotonic function of real clock */
THREAD_LOCAL struct timeval date; /* the real current date */ THREAD_LOCAL struct timeval date; /* the real current date */
struct timeval start_date; /* the process's start date */ struct timeval start_date; /* the process's start date */
@ -278,7 +276,6 @@ void tv_init_process_date()
now = after_poll = before_poll = date; now = after_poll = before_poll = date;
global_now = ((ullong)date.tv_sec << 32) + (uint)date.tv_usec; global_now = ((ullong)date.tv_sec << 32) + (uint)date.tv_usec;
global_now_ms = now.tv_sec * 1000 + now.tv_usec / 1000; global_now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
samp_time = idle_time = 0;
ti->idle_pct = 100; ti->idle_pct = 100;
tv_update_date(0, 1); tv_update_date(0, 1);
} }
@ -296,7 +293,6 @@ void tv_init_thread_date()
old_now = _HA_ATOMIC_LOAD(&global_now); old_now = _HA_ATOMIC_LOAD(&global_now);
now.tv_sec = old_now >> 32; now.tv_sec = old_now >> 32;
now.tv_usec = (uint)old_now; now.tv_usec = (uint)old_now;
samp_time = idle_time = 0;
ti->idle_pct = 100; ti->idle_pct = 100;
tv_update_date(0, 1); tv_update_date(0, 1);
} }