home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!emory!ogicse!news.u.washington.edu!carson.u.washington.edu!cooper
- From: cooper@carson.u.washington.edu (Ken Cooper)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Task Switching, tc_Launch() and tc_Switch()
- Message-ID: <1hnl1eINNd2m@shelley.u.washington.edu>
- Date: 28 Dec 92 19:37:18 GMT
- Article-I.D.: shelley.1hnl1eINNd2m
- Distribution: world
- Organization: University of Washington, Seattle
- Lines: 66
- NNTP-Posting-Host: carson.u.washington.edu
-
-
- I would appreciate it if anybody out there with some knowledge in the
- area of Amiga task switching could help me out. I have been playing around
- over the past couple of days with a program that needs to do some monitoring
- of task switching so that it can accurately determine task CPU usage, among
- other things. I was attempting to use the tc_Launch() and tc_Switch() function
- pointers to do this without any real success. The steps I was using to do this
- was essentially as shown below:
-
- void launch_function(void)
- {
- /* do the launch function stuff */
- }
-
- void switch_function(void)
- {
- /* do the switch function stuff */
- }
-
- void subtask_code(void)
- {
- geta4();
- /* subtask code */
- }
-
- int main(int argc,char **argv)
- {
- struct Task *subtask;
- .....
- Forbid();
- subtask=CreateTask("mysubtask",subtask_code,0,4096);
- subtask->(*tc_Launch)() = launch_function;
- subtask->(*tc_Switch)() = switch_function;
- subtask->tc_Flags |= TF_SWITCH | TF_LAUNCH;
- Permit();
- .....
- }
-
- Due to my lack of success and the poor documentation in the RKM Manuals
- (I am running 2.04 and have the 2.04 Libraries, Devices, and Autodocs Manuals)
- I have the following questions:
-
- 1) Do the tc_Switch() and tc_Launch() hooks actually work?
- 2) What is the correct procedure for setting up these functions?
- 3) What is the state of the cpu and registers when these functions are
- called?
- 4) What do these functions need to do to access the program's global
- variable space? (geta4() or reload registers off the stack?)
- 5) Can these functions be written in C or is assembly language required
- due to the answers to questions 3 and 4?
- 6) Out of curiosity, does the TF_PROCTIME bit in the tc_Flags variable
- do anything? If the PROCTIME accounting does work, where is the
- variable that the time is kept in?
- 7) Are there any other hooks into the EXEC task switching function?
-
- I would really appreciate answers to any of these questions from anybody
- that knows anything about this stuff. Of course, if it were documented
- properly in the RKM manuals I would need to take up your time.
-
- Best Regards,
-
- Ken Cooper
- Applied Physics Laboratory
- University of Washington
- cooper@u.washington.edu
- cooper@apl.washington.edu
-