Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!att!cbnewsh!dwc From: dwc@cbnewsh.ATT.COM (Malaclypse the Elder) Newsgroups: comp.arch Subject: Re: Cycle Counter Message-ID: <3033@cbnewsh.ATT.COM> Date: 13 Aug 89 03:31:52 GMT References: Distribution: comp Organization: The Legion of Dynamic Discord Lines: 34 In article , grunwald@flute.cs.uiuc.edu (Dirk Grunwald) writes: > > When doing performance monitoring, benchmarking or profiling, you want > a high-resolution timer. Some systems have microsecond timers, and > those are considered pretty snazzy; I know I was overjoyed when I > found one on the Encore. Normal machines, e.g., a Sun, have about 5 > millisecond resolution. That's pathetic. > in a paper that we presented in the 88 summer usenix, we describe a high resolution timing and tracing package for unix system v (called casper) that takes advantage of the fact that most systems now use programmable interval timers to generate their clock interrupts. these interval timers are usually loaded with an initial value, count down at a rate that is determined by an external clock signal, and generate the clock interrupt when it hits zero. they then reload their initial value and start over again. the nice thing about these things is that they are usually driven at a fairly hit rate. using these interval timers, our package is able to deliver 10 microsecond resolution on the at&t's 3b2 computers and 1 microsecond resolution on the at&t 6386s. not too shabby and cheap too. and yes, when we looked at the suns, we found that they used some hardwired interrupt generator so we could only get clock interrupt resolutions (10 milliseconds). the other nice thing about doing things this way is that since there is usually a kernel variable keeping count of the number of clock interrupts since boot, we can combine the value of the interrupt counter with the value in the countdown timer and not worry about wrap-around. there are problems introduced by the fact that looking at the kernel variable and the countdown timer is not an atomic operation but i refer interested parties to the paper for details. danny chen att!hocus!dwc