Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: measuring runtimes Keywords: runtimes Message-ID: <10110@dog.ee.lbl.gov> Date: 21 Feb 91 15:35:04 GMT References: <2435@alf.informatik.uni-kiel.dbp.de> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Followup-To: comp.sys.sun Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 32 X-Local-Date: Thu, 21 Feb 91 07:35:04 PST In article <2435@alf.informatik.uni-kiel.dbp.de> rn@informatik.uni-kiel.dbp.de (Rilo Nauman) writes: >I need to measure runtimes of functions and moduls of >C-programs under sun-OS.4.1 on a sparc station 1. >I'm looking for a timer with quite a high resolution. The C language provides nothing along these lines. (Perhaps you should have posted to comp.sys.sun. I have redirected followups there.) >Till now, I'm using system-calls to clock() and >setitimer()-/ getitimer()-calls but the best resolution >I can get is about 16.6 ms (60 Hz), (10 ms ). Both SunOS and Sun hardware are generally uncooperative in obtaining precise timings. There are, however, some interesting tricks that can be used: 1. An external clock that plugs into the CPU board. A company located somewhere in Oakland, CA makes these for (at least) the Sun-3; it goes in the DES chip socket. With a little work you can map the device into user space and obtain quite good timings. 2. The SparcStation-1 has a little green LED on it. This is enabled in software, and it is possible to turn it on and off in kernel code. Attaching an external monitor (an oscilloscope will do) will let you time sections of code. As always, you must be careful when timing small sections of code since the code added to get the times affects the results. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab EE div (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov