]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: sched: moved samp_time and idle_time to task.c as well
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Oct 2021 13:58:46 +0000 (15:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Oct 2021 23:41:14 +0000 (01:41 +0200)
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.

include/haproxy/task.h
include/haproxy/time.h
src/task.c
src/time.c

index 1020eea4d32fc1545a7e06bd76c63f03fa07de51..6adba48458fbdbe561ca31b8a29b79b5c2dc1bb6 100644 (file)
 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 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_tasklet;
 extern struct pool_head *pool_head_notification;
index be9a2bb4b4b9da3921df4244bc70900c4b0fd88b..436b1a8a099f0ee81e08d37619ab4f62b8b4a874 100644 (file)
@@ -50,8 +50,6 @@
 #define SETNOW(a)              (*a=now)
 
 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 date;             /* the real current date */
 extern struct timeval start_date;       /* the process's start date */
index 34c8624c91fb5ea611a59753702d0f55a05d7d0d..f77d34300b08051f9ee890c38345bc633359232a 100644 (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 */
 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 */
 
 __decl_aligned_spinlock(rq_lock); /* spin lock related to run queue */
index d6ab185b41163ff390b2fb6ded18c828d50eaf16..99aed11f843174cf3b39cd96689d18624fbc5db0 100644 (file)
@@ -19,8 +19,6 @@
 #include <haproxy/tools.h>
 
 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 date;            /* the real current 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;
        global_now = ((ullong)date.tv_sec << 32) + (uint)date.tv_usec;
        global_now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
-       samp_time = idle_time = 0;
        ti->idle_pct = 100;
        tv_update_date(0, 1);
 }
@@ -296,7 +293,6 @@ void tv_init_thread_date()
        old_now = _HA_ATOMIC_LOAD(&global_now);
        now.tv_sec = old_now >> 32;
        now.tv_usec = (uint)old_now;
-       samp_time = idle_time = 0;
        ti->idle_pct = 100;
        tv_update_date(0, 1);
 }