diff options
Diffstat (limited to 'sys/dev/dt/dt_dev.c')
-rw-r--r-- | sys/dev/dt/dt_dev.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/dev/dt/dt_dev.c b/sys/dev/dt/dt_dev.c index 70273c4ae03..0d9e7282264 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.40 2024/11/05 08:11:54 mpi Exp $ */ +/* $OpenBSD: dt_dev.c,v 1.41 2024/11/26 10:28:27 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org> @@ -102,6 +102,8 @@ struct dt_cpubuf { /* Counters */ unsigned int dc_dropevt; /* [p] # of events dropped */ + unsigned int dc_skiptick; /* [p] # of ticks skipped */ + unsigned int dc_recurevt; /* [p] # of recursive events */ unsigned int dc_readevt; /* [r] # of events read */ }; @@ -490,19 +492,24 @@ int dt_ioctl_get_stats(struct dt_softc *sc, struct dtioc_stat *dtst) { struct dt_cpubuf *dc; - uint64_t readevt = 0, dropevt = 0; + uint64_t readevt, dropevt, skiptick, recurevt; int i; + readevt = dropevt = skiptick = 0; for (i = 0; i < ncpusfound; i++) { dc = &sc->ds_cpu[i]; membar_consumer(); dropevt += dc->dc_dropevt; + skiptick = dc->dc_skiptick; + recurevt = dc->dc_recurevt; readevt += dc->dc_readevt; } dtst->dtst_readevt = readevt; dtst->dtst_dropevt = dropevt; + dtst->dtst_skiptick = skiptick; + dtst->dtst_recurevt = recurevt; return 0; } @@ -725,6 +732,15 @@ dt_pcb_purge(struct dt_pcb_list *plist) } } +void +dt_pcb_ring_skiptick(struct dt_pcb *dp, unsigned int skip) +{ + struct dt_cpubuf *dc = &dp->dp_sc->ds_cpu[cpu_number()]; + + dc->dc_skiptick += skip; + membar_producer(); +} + /* * Get a reference to the next free event state from the ring. */ @@ -736,8 +752,11 @@ dt_pcb_ring_get(struct dt_pcb *dp, int profiling) int prod, cons, distance; struct dt_cpubuf *dc = &dp->dp_sc->ds_cpu[cpu_number()]; - if (dc->dc_inevt == 1) + if (dc->dc_inevt == 1) { + dc->dc_recurevt++; + membar_producer(); return NULL; + } dc->dc_inevt = 1; |