An accurate timestamp

There is one timebase that might be available on your processor that doesn't obey the rules of "base timing resolution" we just described. Some processors have a high-frequency (high-accuracy) counter built right into them, which Neutrino can let you have access to via the ClockCycles() call. For example, on a Pentium processor running at 200 MHz, this counter increments at 200 MHz as well, so it can give you timing samples right down to 5 nanoseconds. This is particularly useful if you want to figure out exactly how long a piece of code takes to execute (assuming of course, that you don't get preempted). You'd call ClockCycles() before your code and after your code, and then compute the delta. See the QNX Neutrino C Library Reference for more details.

Note: Note that on an SMP system, you may run into a little problem. If your thread gets a ClockCycles() value from one CPU and then eventually runs on another CPU, you may get inconsistent results. This stems from the fact that the counters used by ClockCycles() are stored in the CPU chips themselves, and are not synchronized between CPUs. The solution to this is to use thread affinity to force the thread to run on a particular CPU.