commit e1da1915e8966ad38dd327b8728fd3f00557b83a
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon Oct 11 21:40:22 2021 +0000
Attempt to use `pthread_condattr_setclock(&ca, CLOCK_MONOTONIC)`
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 539245305..365ac2a84 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -366,9 +366,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
vsl_to = vsl_t0 + (t - t0) * timebend;
if (vsl_ts > vsl_to) {
- double when = VTIM_real() + vsl_ts - vsl_to;
struct timespec ts;
- ts.tv_nsec = (long)(modf(when, &t) * 1e9);
+ ts.tv_nsec = (long)(modf(vsl_ts - vsl_to, &t) * 1e9);
ts.tv_sec = (long)t;
i = pthread_cond_timedwait(&timebend_cv, &mtx, &ts);
assert(i == 0 || i == ETIMEDOUT);
@@ -487,9 +486,12 @@ main(int argc, char **argv)
pthread_t thr;
int fnum;
struct profile cli_p = {0};
+ pthread_condattr_t ca;
vut = VUT_InitProg(argc, argv, &vopt_spec);
AN(vut);
+ AZ(pthread_condattr_init(&ca));
+ AZ(pthread_condattr_setclock(&ca, CLOCK_MONOTONIC));
AZ(pthread_cond_init(&timebend_cv, NULL));
while ((i = getopt(argc, argv, vopt_spec.vopt_optstring)) != -1) {
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon Oct 11 21:40:22 2021 +0000
Attempt to use `pthread_condattr_setclock(&ca, CLOCK_MONOTONIC)`
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 539245305..365ac2a84 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -366,9 +366,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
vsl_to = vsl_t0 + (t - t0) * timebend;
if (vsl_ts > vsl_to) {
- double when = VTIM_real() + vsl_ts - vsl_to;
struct timespec ts;
- ts.tv_nsec = (long)(modf(when, &t) * 1e9);
+ ts.tv_nsec = (long)(modf(vsl_ts - vsl_to, &t) * 1e9);
ts.tv_sec = (long)t;
i = pthread_cond_timedwait(&timebend_cv, &mtx, &ts);
assert(i == 0 || i == ETIMEDOUT);
@@ -487,9 +486,12 @@ main(int argc, char **argv)
pthread_t thr;
int fnum;
struct profile cli_p = {0};
+ pthread_condattr_t ca;
vut = VUT_InitProg(argc, argv, &vopt_spec);
AN(vut);
+ AZ(pthread_condattr_init(&ca));
+ AZ(pthread_condattr_setclock(&ca, CLOCK_MONOTONIC));
AZ(pthread_cond_init(&timebend_cv, NULL));
while ((i = getopt(argc, argv, vopt_spec.vopt_optstring)) != -1) {
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit