Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!agate!ucbvax!bloom-beacon!eru!hagbard!sunic!dkuug!diku!bombadil From: bombadil@diku.dk (Kristian Nielsen) Newsgroups: comp.sys.amiga.programmer Subject: Re: Amiga system usage statistics (AmigaDOS 1.3) Message-ID: <1991Apr5.125117.23971@odin.diku.dk> Date: 5 Apr 91 12:51:17 GMT References: <1991Mar25.161731.29334@odin.diku.dk> Sender: news@odin.diku.dk (Netnews System) Organization: Department of Computer Science, U of Copenhagen Lines: 47 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. >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...) >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? Well, I went and checked this out in the easter holiday. Actually, Xoper IS reporting 40% cpu-usage with the CPU 100% busy. However, this is not really a timing figure. What xoper does is for each task in the system to count how many times the Exec Switch() gets called with ExecBase->ThisTask equal to the task. Assuming that Switch() is the function actually doing the context switch (and I'm going only on the name here), this means that xoper is in fact counting the number of times each task calls Wait() (directly or indirectly), or is preempted. So, if the input.device is scheduled as often as my ray-tracer, xoper will report roughly the same figure for both, even though the ray-tracer is using a full timeslice each time while input.device may only be taking a few hundred microseconds. The lesson is not to to take the xoper figure as an actual indication of cpu load. Also, please note that this is NOT a flame of Xoper - I find it a very handy program, even if it isn't able to measure how cpu-intensive a task is - after all, it does so many other things so nicely (I wouldn't trust it never to crash my system, though..) Kristian.