Date: Sun, 30 Jun 2002 10:06:00 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: Luigi Rizzo <luigi@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/isa clock.c src/sys/i386/include param.h src/sys/conf options.i386 Message-ID: <42548.1025424360@critter.freebsd.dk> In-Reply-To: Your message of "Sun, 30 Jun 2002 00:56:49 PDT." <200206300756.g5U7unht089253@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Luigi, What is going on here ? I see no code even remotely like this in -current. Surely you are not doing your development on -stable and forgetting about -current ? Poul-Henning In message <200206300756.g5U7unht089253@freefall.freebsd.org>, Luigi Rizzo writ es: >luigi 2002/06/30 00:56:49 PDT > > Modified files: (Branch: RELENG_4) > sys/i386/isa clock.c > sys/i386/include param.h > sys/conf options.i386 > Log: > 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 <timestamp, arg> 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. > > Revision Changes Path > 1.132.2.16 +1 -0 src/sys/conf/options.i386 > 1.54.2.7 +36 -1 src/sys/i386/include/param.h > 1.149.2.5 +20 -0 src/sys/i386/isa/clock.c > -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42548.1025424360>