Dear all,
I am facing a fairly curious problem.
We are developing a USB driver for a data acquisition system. Our hardware delivers data at a selectable rate of 16, 32,…, 1024, 2048 Hz. The driver works absolutely fine, but its “CPU usage” drives me insane. In regular intervals the CPU usage slowly begins to rise until it reaches 100%. After some time it starts declining again and remains at zero. I spent several days looking for a hardware or driver failure but I think there is only one way to explain it:
The windows task manager outputs completely nonsense under certain conditions. I can substantiate this with the following observations:
- Even though the task manager shows 100% CPU usage, the system doesn’t behave anything like it. I can happily use all kind of other applications without any performance loss.
- If I select a data rate of 1024 Hz in our hardware, I get a completely symmetrical CPU “waveform”. The peaks (100%) and troughs (0%) have the same duration. This process just keeps on going and the CPU manager (I am actually using perfmon) gives me a nice looking square wave. The waveform has a period of about 4 minutes (observation).
- To further validate this, one could theoretically show that the waveform period is around 4 minutes, any ideas?
I think the following happens:
The waveform symmetry occurs at 1024 Hz, which would suggest that the task manager polls at 1ms. This gives a slight mismatch of 24 Hz which causes the slow rising and falling of the CPU usage. The task manager doesn’t seem to take the average of CPU usage but some kind of snapshot. If our process kicked in just at the right time, the task manager would assume we used that much CPU usage all the time.
I am sorry about the long text. Its just pretty difficult to describe.
Do you have any similar experience?
Kind regards,
Johannes