paolucci@snll-arpagw.UUCP (Sam Paolucci) (04/13/89)
I'm writing a code which needs to know how much execution time it's using up. Can anybody tell me how to get this information or written a routine to do this? Note, that the time that the code is swapped out does not count in the execution time. The execution time or CPU time is the total time the code has access to the CPU. Also note that the code itself has to be able to determine this information. -- -+= SAM =+- "the best things in life are free" ARPA: paolucci@snll-arpagw.llnl.gov
deven@pawl.rpi.edu (Deven Corzine) (04/16/89)
In article <94@snll-arpagw.UUCP> paolucci@snll-arpagw.UUCP (Sam Paolucci) writes: >I'm writing a code which needs to know how much execution time it's using >up. Can anybody tell me how to get this information or written a routine >to do this? Note, that the time that the code is swapped out does not >count in the execution time. The execution time or CPU time is the total >time the code has access to the CPU. Also note that the code itself has >to be able to determine this information. I need the same thing. I also want to be able to split it between "user" time and "system" time. Is there, say, a vblank (or whatever) updated clock which I could just check against and measure the difference? (at task switch and user/system switch...) Need I add such? Deven -- ------- shadow@pawl.rpi.edu ------- Deven Thomas Corzine --------------------- Cogito shadow@acm.rpi.edu 2346 15th Street Pi-Rho America ergo userfxb6@rpitsmts.bitnet Troy, NY 12180-2306 (518) 272-5847 sum... In the immortal words of Socrates: "I drank what?" ...I think.
ugkamins@sunybcs.uucp (John Kaminski) (04/17/89)
The easiest (best?) way I can think of doing your timings is to use FindTask(0) (find your task) and insert some code for VOID (*tc_Switch)() and VOID (*tc_Launch)(), and inside this, read the timer.device, GETSYSTIME and perhaps using the timer.device library routines for time subtraction. Switch is for when your task is losing the CPU and Launch is for when the task is getting the CPU back. Either try this, or do the 'ole Forbid() and Permit().
andrew@bhpese.bhpese.oz (Andrew Steele) (04/24/89)
In article <94@snll-arpagw.UUCP> paolucci@snll-arpagw.UUCP (Sam Paolucci) writes: >I'm writing a code which needs to know how much execution time it's using >up. Fish Disk 48 contains a program called PerfMon which will monitor a program's execution and then report on the execution times and usage of each routine in the program. This consists of two programs, the first takes the output from the MANX linker and uses the symbol table information to modify the executable so that a trap is called during entry and exit from each function. This is used after linking but prior to execution. The second part of the program runs as a separate task while your program is executing, it basically catches all the traps that are generated and times each routine (using the VBLANK clock). Whilst this may not be exactly what you are after, I found it to be well written and it was easy to understand and modify for my own uses. I Hope this helps. Andrew Steele _____ Spengat Technologies, /_ _\ c/o Electrical Computer Services, ACSnet : andrew@bhpese.oz __| |__ BHP Rod & Bar Products Division, INTERNET: andrew@bhpese.oz.au /__| |__\ Newcastle, NSW, Australia. UUCP : ...!{uunet,mcvax}!munnari!bhpese.oz!andrew
ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (04/24/89)
In article <94@snll-arpagw.UUCP> paolucci@snll-arpagw.UUCP (Sam Paolucci) writes: >I'm writing a code which needs to know how much execution time it's using >up. Can anybody tell me how to get this information or written a routine >to do this? [ ... ] Far Back in the Mists of Ancient Time, in the days of Kickstart v21, the very information you're interested in was encoded in the Task structure. However, in a subsequent release, it got taken out. Perhaps one of the long standing AmiGuys might care to explain why. Funny, though; the TF_PROCTIME bit is still declared in exec/tasks.h Your best bet is to fiddle with the tc_Launch and tc_Switch fields to dispatch to a (brief!) routine to record accumulated time. You must set the TF_SWITCH and TF_LAUNCH bits in the tc_Flags field for these to have any effect. You should not assume that tc_Launch and tc_Switch are unused (i.e. someone else may be trying to use these, too). _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ Leo L. Schwab -- The Guy in The Cape INET: well!ewhac@ucbvax.Berkeley.EDU \_ -_ Recumbent Bikes: UUCP: pacbell > !{well,unicom}!ewhac O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack") "Work FOR? I don't work FOR anybody! I'm just having fun." -- The Doctor
walker@sas.UUCP (Doug Walker) (04/28/89)
You don't say what compiler/assembler you are using, but if your executable is compatible with the standard Amiga object file format (read: not Manx) you should be able to use the Lattice profiler that comes with Lattice 5.0. --- Doug
paolucci@snll-arpagw.UUCP (Sam Paolucci) (04/29/89)
In article <1019@sas.UUCP> walker@sas.UUCP (Doug Walker) writes:
->You don't say what compiler/assembler you are using, but if your executable
->is compatible with the standard Amiga object file format (read: not Manx)
->you should be able to use the Lattice profiler that comes with Lattice 5.0.
This does not answer my question. The original question was how to find
out the current CPU time a program is using up. The program itself has
to be able to determine this. I would have thought that such a function
would have been part of the system library, since it is available on
all other multitasking (and multiuser) operating systems that I know.
--
-+= SAM =+-
"the best things in life are free"
ARPA: paolucci@snll-arpagw.llnl.gov