Copyright (c) 2000 Mark R V Murray All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or ot...
NAMEget_cyclecount - get the CPU's fast counter register contents
SYNOPSISIn sys/param.h In sys/systm.h In machine/cpu.h Ft uint64_t Fn get_cyclecount void
DESCRIPTIONThe Fn get_cyclecount function uses a register available in most modern CPUs to return a value that is monotonically increasing inside each CPU.
On SMP systems, there will be a number of separate monotonic sequences, one for each CPU running. The value in the SMP case is selected from one of these sequences, dependent on which CPU was scheduled to service the request.
The speed and the maximum value of each counter is CPU-dependent. Some CPUs (such as the Intel 80486) do not have such a register, so Fn get_cyclecount on these platforms returns a (monotonic) combination of numbers represented by the structure returned by binuptime(9).
The AMD64 and Intel 64 processors use the TSC register.
The IA64 processors use the AR.ITC register.