there are several topics on this site about better quality time functions. Clock works fine but it fails for things that complete very quickly, so be sure that whatever you use it for is at least a ms or two duration.
process time is the amount of time for which a CPU was used for processing instructions of a computer program, as opposed to, for example, waiting for input/output (I/O) operations
I was using rdtsc register on intel before they invented variable speed CPU clock, which ruined that for wall clock but it still is accurate on how many operations a task took. I think you have to use emit + hex code to invoke it with inline assembler. Before the new cpus you could divide by cpu hz to get wall time, and its still close on that for small periods but its not exact anymore.
I was using rdtsc register on intel before they invented variable speed CPU clock, which ruined that for wall clock but it still is accurate on how many operations a task took
The invariant TSC will run at a constant rate in all ACPI P-, C-. and T-states. This is the architectural behavior moving forward. On processors with invariant TSC support, the OS may use the TSC for wall clock timer services (instead of ACPI or HPET timers). TSC reads are much more efficient and do not incur the overhead associated with a ring transition or access to a platform resource."
That is awesome news. I havent been doing real time coding, I actually on a database that can somehow spend 10+ min doing what C can do in 5 nanoseconds, but that is a great tool for anyone doing performance tuning or precisely timed code.