home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17868 < prev    next >
Encoding:
Text File  |  1992-12-28  |  3.0 KB  |  79 lines

  1. Path: sparky!uunet!gatech!emory!ogicse!news.u.washington.edu!carson.u.washington.edu!cooper
  2. From: cooper@carson.u.washington.edu (Ken Cooper)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Task Switching, tc_Launch() and tc_Switch()
  5. Message-ID: <1hnl1eINNd2m@shelley.u.washington.edu>
  6. Date: 28 Dec 92 19:37:18 GMT
  7. Article-I.D.: shelley.1hnl1eINNd2m
  8. Distribution: world
  9. Organization: University of Washington, Seattle
  10. Lines: 66
  11. NNTP-Posting-Host: carson.u.washington.edu
  12.  
  13.  
  14.      I would appreciate it if anybody out there with some knowledge in the
  15. area of Amiga task switching could help me out.  I have been playing around
  16. over the past couple of days with a program that needs to do some monitoring
  17. of task switching so that it can accurately determine task CPU usage, among
  18. other things.  I was attempting to use the tc_Launch() and tc_Switch() function
  19. pointers to do this without any real success.  The steps I was using to do this
  20. was essentially as shown below:
  21.  
  22.         void launch_function(void)
  23.         {
  24.               /* do the launch function stuff */
  25.         }
  26.  
  27.         void switch_function(void)
  28.         {
  29.               /* do the switch function stuff */
  30.         }
  31.  
  32.         void subtask_code(void)
  33.         {
  34.               geta4();
  35.               /* subtask code */
  36.         }
  37.  
  38.         int main(int argc,char **argv)
  39.         {
  40.               struct Task *subtask;
  41.               .....
  42.               Forbid();
  43.               subtask=CreateTask("mysubtask",subtask_code,0,4096);
  44.               subtask->(*tc_Launch)() = launch_function; 
  45.               subtask->(*tc_Switch)() = switch_function;
  46.               subtask->tc_Flags |= TF_SWITCH | TF_LAUNCH;
  47.               Permit();
  48.               .....
  49.         }
  50.  
  51.      Due to my lack of success and the poor documentation in the RKM Manuals
  52. (I am running 2.04 and have the 2.04 Libraries, Devices, and Autodocs Manuals)
  53. I have the following questions:
  54.  
  55.       1)  Do the tc_Switch() and tc_Launch() hooks actually work?
  56.       2)  What is the correct procedure for setting up these functions?
  57.       3)  What is the state of the cpu and registers when these functions are
  58.           called?
  59.       4)  What do these functions need to do to access the program's global
  60.           variable space? (geta4() or reload registers off the stack?)
  61.       5)  Can these functions be written in C or is assembly language required
  62.           due to the answers to questions 3 and 4?
  63.       6)  Out of curiosity, does the TF_PROCTIME bit in the tc_Flags variable
  64.           do anything?  If the PROCTIME accounting does work, where is the
  65.           variable that the time is kept in?
  66.       7)  Are there any other hooks into the EXEC task switching function?
  67.  
  68.     I would really appreciate answers to any of these questions from anybody
  69. that knows anything about this stuff.  Of course, if it were documented 
  70. properly in the RKM manuals I would need to take up your time.
  71.  
  72. Best Regards,
  73.  
  74. Ken Cooper
  75. Applied Physics Laboratory
  76. University of Washington
  77. cooper@u.washington.edu
  78. cooper@apl.washington.edu
  79.