On Tue, Mar 28, 2023, Marc Zyngier wrote: > On Tue, 21 Mar 2023 19:10:04 +0000, > Colton Lewis <coltonlewis@xxxxxxxxxx> wrote: > > In context, I'm trying to measure the time it takes to write to a buffer > > *with dirty memory logging enabled*. What do you mean by zero? I can > > confirm from running this code I am not measuring zero time. > > See my earlier point: the counter tick is a few MHz, and the CPU > multiple GHz. On x86, the system counter (TSC) counts at multiple GHz, so we should be able to continue with that approach for x86. > So unless "whatever" is something that takes a significant time (several > thousands of CPU cycles), you'll measure nothing using the counter. Page > faults will probably show, but not a normal access. > > The right tool for this job is to use PMU events, as they count at the CPU > frequency. Out of curiosity, what does the kernel end up using for things like ndelay()? I tried to follow the breadcrumbs for ARM and got as far as arm_arch_timer.c, but after that I'm more than a bit lost.