home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / programming / appstat / !APPstat / !Help next >
Encoding:
Text File  |  1998-06-07  |  13.8 KB  |  304 lines

  1.  
  2.  
  3.                         Application Statistics
  4.                         ======================
  5.                         
  6.  
  7. Documentation for !APPstat application version 1.10 07-Jun-1998
  8. for RISC OS 3.1 and later.
  9.  
  10. Issue: 1.10 07-Jun-1998, replaces:      0.10      03-May-1995
  11.                                         0.90      28-May-1995
  12.                                         0.99      17-Jun-1995
  13. Author: David J Ruck
  14.  
  15. Copyright © DEEJ Technology PLC 1995-8
  16.  
  17.  
  18.  
  19. Overview
  20. ========
  21.  
  22. The !APPstat application provides information on the activity of all running 
  23. RISC OS application in your machine, it is the best tool available for
  24. ensuring  that your WIMP programs are fast and efficient.
  25.  
  26. It is intended for programmers who wish to debug or improve the efficiency
  27. of  their applications. It does this by showing exactly which WIMP events
  28. are  being delivered to each application, in what quantity, and how long the 
  29. application takes to process them.
  30.  
  31. It can also be used by the merely incurably curious for a fascinating
  32. insight  into  what the computer is getting up to, and which tasks are
  33. hogging the CPU.
  34.  
  35.  
  36.  
  37. Using !APPstat
  38. ==============
  39.  
  40. When started !APPstat installs its own icon on the icon bar, clicking on it
  41. will  display the main window. This window contains information on all 
  42. applications that are active at the current time.
  43.  
  44. Each running application has its own entry, giving its name, a value and a 
  45. graphic display of this value, similar to the bars used in the Task
  46. manager's  window.
  47.  
  48. The value is one of four types, the number of calls to the application or
  49. the  time spent in the application, either as a total value or the value
  50. occurring over  a definable time interval. Switching between these displays
  51. is described in the  !APPstat menu section below.
  52.  
  53. The Main Window The first entry in the window is the total value of all the 
  54.                 entries below corresponding to the time between updates of
  55.                 the display. The next two bars display the system overhead 
  56.                 and the totals for all applications.
  57.                 
  58.                 The system overhead is the time the WIMP spends in the 
  59.                 WIMP_Poll SWI. When displaying call counts all three bars 
  60.                 have the same value, corresponding to the number of calls 
  61.                 made to all applications.
  62.  
  63.                 The bars below correspond to the call/times for each running 
  64.                 application. Clicking on All Applications any of the 
  65.                 application names will display a subwindow for that 
  66.                 application. The All Applications subwindow shows the 
  67.                 combined information for every running application.
  68.  
  69.                 Any new applications which are started while !APPstat is run 
  70.                 are added to the end of the main window.
  71.                 
  72. Sub Windows     The subwindows for each application are similar to that of 
  73.                 the main window, except that the number of calls or timings 
  74.                 for each WIMP event and message that the application receives
  75.                 are displayed.
  76.  
  77.                 The first entry is the total for that application, as is 
  78.                 displayed in the main window. The next twenty entries 
  79.                 correspond to each of the event codes returned by the 
  80.                 Wimp_Poll SWI. The remaining entries in the window are 
  81.                 the calls/timings for each type of message delivered to 
  82.                 the application on event types 17 and 18 (Send Message and 
  83.                 Send Message Want Ack). Messages returned by event 19 
  84.                 (Acknowledge Message) are not counted by these bars.
  85.                 
  86.                 Events and messages, which are recognised by the program 
  87.                 are assigned names, others will be displayed as a numbers. 
  88.                 Most common message types are already displayed, others will 
  89.                 be added to the window when they occur.
  90.  
  91. Counter Windows Clicking on the Applications & System, or System Overhead 
  92.                 entries in the main window or any entry in a subwindow will 
  93.                 call up a counter window.
  94.                 
  95.                 The counter window shows the number of calls or the time 
  96.                 spent processing (an individual event/message or the total 
  97.                 for an application) occurring in the set interval, as a 
  98.                 vertical line. The display scrolls to the left each interval 
  99.                 to show a new value, thus the variation in activity of a 
  100.                 application can be monitored over a period of time.
  101.  
  102.                 It is easier to see sudden peaks of activity in a counter 
  103.                 window than in the main and subwindows, which do not need 
  104.                 to be open once a counter window has been called up. Any 
  105.                 number of counter windows (memory permitting) can be active 
  106.                 at once.
  107.                 
  108.                 The counter window display automatically scales up and down 
  109.                 to fit the maximum value in the window. At the default scale 
  110.                 4 OS units (1 rectangular pixel) is equivalent to one call or
  111.                 1µs, each subsequent scale is half the last shown by the 
  112.                 horizontal grey lines. These do not represent values but show 
  113.                 how many times the height of the bars have been halved;
  114.                 e.g. 1 line = ½ scale, 2 lines = ¼ scale, 10 lines 1/1024th 
  115.                 scale.
  116.  
  117.  
  118. Window menu
  119. -----------
  120. The main window and all subwindows provide a menu, the entries are described
  121. below.
  122.  
  123. Totals          This affects the main window and all subwindows. When ticked 
  124.                 the display of each window gives the number of calls or time 
  125.                 spent processing for each application or WIMP event since 
  126.                 !APPstat was started (or Zero counts was used). 
  127.  
  128. Per interval    This also affects the main window and all subwindows; it 
  129.                 changes the displays to show the number of calls / time spent
  130.                 over a given time interval, set by Update rate below. The 
  131.                 dark grey window titles changes to show the desired rate, and
  132.                 in brackets, the actual rate achieved in milliseconds.
  133.                 
  134. Call Counts     This option effects the main window, all subwindows and all 
  135.                 counters currently displayed. When ticked the number of calls
  136.                 to each application or for each WIMP event/message will be 
  137.                 displayed in the windows.
  138.                 
  139. Timings         When ticked all windows and counters will display the time 
  140.                 the applications spend processing each WIMP event/message. 
  141.                 The timings are displayed in seconds, with the factional 
  142.                 value accurate to the nearest microsecond.
  143.                 
  144. Update rate     The value entered into the writable sub menu determines the 
  145.                 interval used when displaying in Per interval mode, and the 
  146.                 update rate of counter windows, which always show the number 
  147.                 of calls/timings during this interval in both Totals and Per 
  148.                 interval modes.
  149.                 
  150.                 The value entered is in milliseconds (1/1000th sec), due to 
  151.                 RISC OS limitations it is only possible to set the rate to 
  152.                 the nearest 10ms, a minimum of 100ms is imposed. When using 
  153.                 large values it should be noted that the new value only comes
  154.                 into effect on the next scheduled update.
  155.  
  156.                 If a lot of tasks are running or a number of subwindows or 
  157.                 counter windows are open it may not be possible for the 
  158.                 program to update its displays at very high rates, this is 
  159.                 automatically taken into account, and the values and sizes 
  160.                 of bars are corrected accordingly.
  161.  
  162. Scale           Bars in the main and subwindows are automatically scaled to 
  163.                 fit the largest in the window by default, this can however, 
  164.                 lead to the bars for small values disappearing. Clicking on 
  165.                 the Scale option on the main menu toggles automatic and 
  166.                 manual scaling, which is shown by a tick next to scale.
  167.  
  168.                 When using manual scaling values can be entered in the 
  169.                 writable submenu, integer and fractional values are allowed.
  170.  
  171.  
  172. Iconbar menu
  173. ------------
  174. Info            Displays program information and version number.
  175.  
  176. Display         Displays the main window, equivalent to clicking on the 
  177.                 !APPstat icon.
  178.  
  179. Kill            Quits the application and kills the APPmod module which 
  180.                 performs the counting and timing monitoring of applications. 
  181.                 This ensures the small processing overhead imposed by the 
  182.                 module is removed.
  183.  
  184. Quit            Quits the application, the APPmod module is not killed so if 
  185.                 the program is run again, the application counts and timing 
  186.                 totals will still have been incremented while the program 
  187.                 was not running, see Technical details below.
  188.  
  189.  
  190.  
  191. Technical details
  192. =================
  193.  
  194. !APPstat works by loading a special module APPmod which installs WIMP  pre
  195. and post–filters to enable the module to recognise when an application has 
  196. been switched in by the WIMP.
  197.  
  198. The post–filter enables the type of event that is being delivered to the 
  199. application to be extracted and separate counts and timings held for each.
  200.  
  201. The timings are obtained by reading the IOC timer 0 and the monotonic 
  202. system clock (which is incremented by the timer 0 events). The timer and 
  203. clock values are combined to produce a second and microsecond time value.
  204. The details below are provided for users who may wish to use this module in 
  205. their own programs.
  206.  
  207. Note: The SWI chunk number for APPmod is currently 
  208. provisional and will change on receiving official Acorn registration.
  209.  
  210. APP_stat                !APPstat uses this call every update interval to
  211. (&C4580 provisional)    read the current APP call counts and timing
  212.                         information, and calculate the correct values for 
  213.                         the program displays.
  214.                                 
  215.                         A call to APP_stat (no parameters required) returns 
  216.                         a pointer in R0 to a memory structure (type: main_str)
  217.                         which is described in C as:
  218.  
  219.     typedef struct
  220.     {
  221.         struct app__str  *chain_ptr;    /* pointer to chain of app_str     */
  222.         timeval          sys_time;      /* total of system execution time  */
  223.     } main_str;
  224.     
  225.     typedef struct app__str
  226.     {
  227.         struct app__str  *next_ptr;     /* pointer to next in chain        */
  228.         wimp_t           task;          /* task handle of application      */
  229.         stat_str         app_total;     /* total count/time for this app   */
  230.         stat_str         events[20];    /* counts/time for wimp events     */
  231.         msgstat_str      messages[256]; /* counts/time for 256 messages    */
  232.     } app_str;
  233.  
  234.     typedef struct
  235.     {
  236.         wimp_msgaction   action;        /* message action or -1 not used   */
  237.         stat_str         info;          /* count/time for message type     */
  238.         } msgstat_str;
  239.  
  240.     typedef struct
  241.     {
  242.         long             count;         /* numbers of calls for item       */
  243.         timeval          time;          /* total run time for item         */
  244.     } stat_str;
  245.  
  246.     typedef struct
  247.     {
  248.         long             tv_sec;        /* time in seconds                 */
  249.         long             tv_usec;       /* microsecond excess              */
  250.     } timeval;
  251.  
  252.  
  253.                         The main_str chain_ptr points to a list of app_str
  254.                         for each application, terminated by a 0 in next_ptr 
  255.                         of the last app_str. The first app_str in the list 
  256.                         has a task handle of -1 and corresponds to All 
  257.                         Applications combined totals.
  258.                         
  259.                         Only some of the 256 possible messages entries are 
  260.                         assigned to valid message action types initially. 
  261.                         The msgstat_str action field contains -1 if the entry
  262.                         is not assigned. Further entries are assigned on 
  263.                         receipt of new message types. 
  264.  
  265. APP_Zero                Calling this routine causes all the counts and 
  266. (&C4581 provisional)    timings to be zeroed. Counting continues immediately.
  267.  
  268. APP_Control             This call is used to activate (R0 = 1) or suspend 
  269. (&C4582 provisional)    (R0 = 0) the modules counting and timing activity. 
  270.                         While suspended the WIMP filters are still enabled, 
  271.                         but computational overhead of the counting and timing
  272.                         operations are removed.
  273.  
  274.  
  275. Changes
  276. =======
  277.  
  278. 1.10    Known message list updated.
  279.         Unknown message numbers named after module SWI chunks if appropriate.
  280.  
  281.  
  282.  
  283. !SWIstat
  284. ========
  285.  
  286. Also from DEEJ Technology PLC is the companion application !SWIstat.  Using
  287. the same style of displays !SWIstat provides information on the activity  of
  288. all SoftWare Interrupts (SWI's) occurring in your machine, the next best 
  289. thing to Acorns own hardware debugging systems.
  290.  
  291. It is intended for programmers who wish to debug or improve the efficiency
  292. of  their application's or module's interface with the OS. It does this by
  293. showing  exactly which software interrupt calls are being made, when and in
  294. what  quantity.
  295.  
  296. !SWIstat can monitor SWI activity from all applications running in the 
  297. machine, or just a chosen one, enabling scrutiny of a particular application 
  298. under test. All tasks except !SWIstat can be monitored to partially remove
  299. the  effect of running the application in a development environment.
  300.  
  301.  
  302.  
  303. End of APPstat User Guide.
  304.