For my application, I need to have a reliable way of knowing the CPU speed. It is clear that HAL does not work reliably on all devices for this purpose.

I tried writing assembly code but for that I need real time thread priorities, algorithm fails if thread switching happens amidst profiling code. But I don't have enough capability for raising threads priority to Real Time. The algorithm is tested on windows mobile and gives very accurate results.

Is there another way (algorithm/Tool/API) which I can use to do so. Ideally I would want to use it in my application and get CPU speed at run time.

Please Help.