Section 2.6.6 of Intel’s volume 3 of IA-32 manual describes the “Time-Stamp Counter”. It counts each HZ.
For access in C this assembler code for the PowerPC provides the unsigned long long register value as TB() and the value of the low unsigned 32 bits as TLl(). An appropriate header would be:
long long TB(void); unsigned int TBl(void);How fast can you read the a 100 MHz PPC clock?
Here is a trivial PPC demo. The shell command gcc -O3 tt.c tb.s compiles the code and its demo and ./a.out runs it.
Here is a PPC program that watches the clock and reports periods of running and suspension. This reveals a large stream of covert information. gcc -O3 td.c tb.s; ./a.out to run it.
gcc xx.s tt.c -O3 -Wmost
gcc -O3 tx86.c tbx86.s -Wall ./.outyields
279 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 54 45 45 54 45 54 45 ave = 52.55on my MacBook.