unsigned __int64 GetCycleCount(void)

    {

    _asm _emit 0x0F

    _asm _emit 0x31

}

unsigned cpuspeed(void)

    {

    unsigned __int64 start, stop;

    unsigned total;

    start = GetCycleCount();

    Sleep(1000);

    stop = GetCycleCount();

    stop = stop - cpustart;

    total = (unsigned)(stop/1000000);

    return total;

}