summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2024-02-29 00:18:49 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2024-02-29 00:18:49 +0000
commit8a0b0e8799b1675f2cc06f19940c4ce49387d345 (patch)
treeed4dad958c27495cff504422c3ebe6d7a488c502
parent0340ebb3004c4c093389677f9bc48d26a31a23f6 (diff)
dt(4): interval, profile: schedule clockintr relative to start of recording
For the interval and profile providers, schedule the first clock interrupt to occur dp_nsecs nanoseconds after the start of recording. This makes the interval between the start of recording and the first event consistent across runs. With input from claudio@. Simplified by claudio@. Thread: https://marc.info/?l=openbsd-tech&m=170879058205043&w=2 ok mpi@ claudio@
-rw-r--r--sys/dev/dt/dt_dev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/dt/dt_dev.c b/sys/dev/dt/dt_dev.c
index e11122687eb..98b19792d82 100644
--- a/sys/dev/dt/dt_dev.c
+++ b/sys/dev/dt/dt_dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dt_dev.c,v 1.31 2024/02/18 00:54:03 cheloha Exp $ */
+/* $OpenBSD: dt_dev.c,v 1.32 2024/02/29 00:18:48 cheloha Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@@ -477,6 +477,7 @@ dt_ioctl_get_stats(struct dt_softc *sc, struct dtioc_stat *dtst)
int
dt_ioctl_record_start(struct dt_softc *sc)
{
+ uint64_t now;
struct dt_pcb *dp;
if (sc->ds_recording)
@@ -487,6 +488,7 @@ dt_ioctl_record_start(struct dt_softc *sc)
return ENOENT;
rw_enter_write(&dt_lock);
+ now = nsecuptime();
TAILQ_FOREACH(dp, &sc->ds_pcbs, dp_snext) {
struct dt_probe *dtp = dp->dp_dtp;
@@ -497,7 +499,8 @@ dt_ioctl_record_start(struct dt_softc *sc)
if (dp->dp_nsecs != 0) {
clockintr_bind(&dp->dp_clockintr, dp->dp_cpu, dt_clock,
dp);
- clockintr_advance(&dp->dp_clockintr, dp->dp_nsecs);
+ clockintr_schedule(&dp->dp_clockintr,
+ now + dp->dp_nsecs);
}
}
rw_exit_write(&dt_lock);