From owner-cvs-all Sun Jun 30 1: 8:20 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FFDB37B400; Sun, 30 Jun 2002 01:08:12 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 58F0B43E1A; Sun, 30 Jun 2002 01:08:11 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.3/8.12.2) with ESMTP id g5U8606I042549; Sun, 30 Jun 2002 10:06:00 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Luigi Rizzo 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 In-Reply-To: Your message of "Sun, 30 Jun 2002 00:56:49 PDT." <200206300756.g5U7unht089253@freefall.freebsd.org> Date: Sun, 30 Jun 2002 10:06:00 +0200 Message-ID: <42548.1025424360@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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