2 ms·
I had closely related problem in desktop application. It does some device control and works on USB interrupts at 256 or 512 invocations per sec. To account for
by FpUser 5y ago
I had closely related problem in desktop application. It does some device control and works on USB interrupts at 256 or 512 invocations per sec. To account for a jitter and some other things I also inserted some time measuring calls. Inside the handler there were some calculations but I've discovered that those consume disproportionate amount of time. The investigation revealed that on multicore CPUs QueryPerformanceCounter call can take 1 microsecond. Since I had quite a few of those it added up to way too much. Ended up writing small piece of assembly that checked if invariant TSC is supported on CPU (which it is for any reasonable CPU) and replaced time measuring calls supplied by the OS to RDTSC that takes just nanoseconds.
The strange thing is that where possible QueryPerformanceCounter should use just RDTSC internally accordingly to docs. By timing it it appears that at least in my case it did not.