K 10 svn:author V 5 luigi K 8 svn:date V 27 2002-06-30T07:56:49.000000Z K 7 svn:log V 1473 Add one function and one macro to timestamp events in the kernel using the TSC register and which are just too conveninent not to have them around. The macro (defined in sys/i386/include/param.h) is called TSTMP(class:4, unit:4, event:8, par:16) which in turn calls _TSTMP(arg) (function defined in sys/i386/isa/clock.c) which stores a pair of u_int32_t values in a circular buffer exported to userland as the sysctl variable debug.timestamp The content of the buffer can be printed with something like sysctl -b debug.timestamp | hexdump -e '"%15u %15u\n"' This functionality must be enabled with "options KERN_TIMESTAMP", otherwise both the macro and the function are redefined as empty blocks. This code is i586+ specific, but it does not make any attempt to grab locks, identify which CPU it is running on, etc. etc. -- it is a debugging tool, and a very very simple and low level one, so you are supposed to know how to use it if you do not want to get random numbers out of it. I am committing this to RELENG_4 only because on -current parts of the kernel might run concurrently, so the use of a single unprotected static variable as the index of the next entry in the buffer might lead to inconsistent results. Plus, there might be similar stuff in -current already. If someone feels like porting this code to -current, it might be a good idea to keep separate per-cpu buffers to avoid the cost of protecting against concurrent accesses. END