Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!drysdale From: drysdale@cbmvax.commodore.com (Scott Drysdale) Newsgroups: comp.sys.amiga.programmer Subject: Re: Amiga system usage statistics (AmigaDOS 1.3) Message-ID: <20119@cbmvax.commodore.com> Date: 26 Mar 91 03:26:46 GMT References: <1991Mar25.161731.29334@odin.diku.dk> Reply-To: drysdale@cbmvax.commodore.com (Scott Drysdale) Organization: Commodore, West Chester, PA Lines: 52 In article <1991Mar25.161731.29334@odin.diku.dk> bombadil@diku.dk (Kristian Nielsen) writes: >ben@epmooch.UUCP (Rev. Ben A. Mesander) writes: > >>I'd like to write a program to compute percent CPU usage and store the >>usage data every so often into a file (I'd like to monitor how certain >>programs I run, such as UUCP news unbatching, use my system at 4AM and >>such). I'm aware of interactive tools like perfmon and Xoper, but I don't >>know of any program that does what I want for the Amiga. > >>Does anyone know of source to an interactive monitor program that I could >>look at and see how to collect this sort of data? Or could someone point >>me in the right direction (I have the RKM's)? Or is there a program that >>already does what I need? > >>I'd like to be able to set the interval used to collect the CPU usage data, >>although, I suppose a fixed interval would not be useless. the simplest way to find out how much cpu you've got left when doing something is to create a task at the lowest priority and have it just count. another task runs 0 or higher priority off a timer (say 1 second) and snapshots the counter and clears it. this, of course, doesn't narrow things down to which particular task is using all the cpu time. it also doesn't give you a percentage (just raw machine dependent "ticks"). you'll have to find out what the "no cpu used at all" value is on each system you run it on, and use that number and the running values to get percentages. >Xoper, including the full source code (in >100k assembler) is available on >the fish series. From a brief look-over it would sem that it hooks into the >exec.library Switch() system call. This, however is less than >well-documented in the RMK's (probably for a good reason, but still...) doing things like i just described and patching Switch() and keeping track of all tasks would give you what you want. this isn't simple, though, since there aren't any convenient fields in the task structure for you to use for record keeping. >BTW, I suspect that Xoper isn't that accurate in its timings... On my GVP >28Mhz 3001 it likes to report that input.device is using about 40% of >CPU-time at full load (ray-tracing or similar). I really don't hope that >this is the case! (and if it is, how is a stock A500/2000 to run at all??) >Any comments on this? > > Kristian. --Scotty -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Scott Drysdale Software Engineer Commodore Amiga Inc. UUCP {allegra|burdvax|rutgers|ihnp4}!cbmvax!drysdale PHONE - yes. "Have you hugged your hog today?" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=