]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: time: remove the now unused ms_left_scaled
authorWilly Tarreau <w@1wt.eu>
Sat, 10 Apr 2021 23:40:13 +0000 (01:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Apr 2021 12:01:53 +0000 (14:01 +0200)
It was only used by freq_ctr and is not used anymore. In addition the
local curr_sec_ms was removed, as well as the equivalent extern
definitions which did not exist anymore either.

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

index 93dd840800dc7fe148e86840b75f90d66a5b3077..f5c0da6926aea283326331af3ce3e3f56c319356 100644 (file)
@@ -49,9 +49,6 @@
 #define MINTIME(old, new)      (((new)<0)?(old):(((old)<0||(new)<(old))?(new):(old)))
 #define SETNOW(a)              (*a=now)
 
-extern THREAD_LOCAL unsigned int   curr_sec_ms;      /* millisecond of current second (0..999) */
-extern THREAD_LOCAL unsigned int   ms_left_scaled;   /* milliseconds left for current second (0..2^32-1) */
-extern THREAD_LOCAL unsigned int   curr_sec_ms_scaled;  /* millisecond of current second (0..2^32-1) */
 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 */
index fafe3720eb82f802fc5d7acfb445e6c8bc032186..9901dab103d6086d31de612aff672c5f94b607a8 100644 (file)
@@ -18,7 +18,6 @@
 #include <haproxy/ticks.h>
 #include <haproxy/tools.h>
 
-THREAD_LOCAL unsigned int   ms_left_scaled;  /* milliseconds left for current second (0..2^32-1) */
 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 */
@@ -178,7 +177,6 @@ int _tv_isgt(const struct timeval *tv1, const struct timeval *tv2)
 void tv_update_date(int max_wait, int interrupted)
 {
        struct timeval adjusted, deadline, tmp_now, tmp_adj;
-       unsigned int   curr_sec_ms;     /* millisecond of current second (0..999) */
        unsigned int old_now_ms, new_now_ms;
        unsigned long long old_now;
        unsigned long long new_now;
@@ -250,19 +248,7 @@ void tv_update_date(int max_wait, int interrupted)
 
  to_ms:
        now = adjusted;
-       curr_sec_ms = now.tv_usec / 1000;            /* ms of current second */
-
-       /* For frequency counters, we'll need to know the ratio of the previous
-        * value to add to current value depending on the current millisecond.
-        * The principle is that during the first millisecond, we use 999/1000
-        * of the past value and that during the last millisecond we use 0/1000
-        * of the past value. In summary, we only use the past value during the
-        * first 999 ms of a second, and the last ms is used to complete the
-        * current measure. The value is scaled to (2^32-1) so that a simple
-        * multiply followed by a shift gives us the final value.
-        */
-       ms_left_scaled = (999U - curr_sec_ms) * 4294967U;
-       now_ms = now.tv_sec * 1000 + curr_sec_ms;
+       now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
 
        /* update the global current millisecond */
        old_now_ms = global_now_ms;