home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / tools / profiler / prf / readme < prev   
Text File  |  1988-11-24  |  2KB  |  69 lines

  1.  
  2. This is a small package to help you decide where a 
  3. small or compact model program running under MSDOS is
  4. spending its time..
  5.  
  6. It is limited. It does not take into account time spent
  7. in system calls from a routine, it can only handle a single
  8. code segment.  That said it can probably help you direct your
  9. efforts to those computationally intensive parts of your program
  10. that need to be tightened up.
  11.  
  12. To use the package a TSR routine (prf.exe) needs to be installed.
  13. i.e. at the MSDOS prompt (or in autoexec.bat) type "PRF" (no quotes).
  14.  
  15. Within your program you will need to call two routines. These should
  16. be invoked before and after the bits you want to profile.
  17.  
  18. Here is a sample program.
  19.  
  20. ------------------------------
  21. #include <stdio.h>
  22. #include "prfifl.h"
  23. #include <dos.h>
  24. long TT()
  25. {
  26.     int i; long j;
  27.  
  28.     for(i = 0 ; i < 16 ; i++)j += i ; return j;
  29. }
  30. main(argc, argv)
  31. int argc;
  32. char **argv;
  33. {
  34.     long l, ac = 0;
  35.  
  36.     /* START PROFILING */
  37.     PRFstart((long far *)main);
  38.         for (l=0;l<100000L;l++) ac += l*l + TT();
  39.     /* STOP PROFILING */
  40.     PRFstop();
  41. }
  42. ------------------------------
  43.  
  44. the program should be linked to include the files
  45.     PRFIFL.OBJ and PRFUTIL.OBJ
  46. and you will need the .MAP file, so specify /MA as an option.
  47. e.g a link command line of the form
  48.  
  49.     link myprog+prfifl+prfutil,,,/MAP/LI
  50.  
  51. These include 'C' routines and so will need 'C' support
  52. for the creation of the profile data file (fixed at PROFIL.OUT).
  53.  
  54. After running the program you will find the file PROFIL.OUT has
  55. appeared and contains a list of the number of times that the clock
  56. interrupt found that it had interrupted your program at each ip value.
  57. ( strictly speaking within the 8 byte block following the printed IP)
  58.  
  59. To get a slightly more user friendly report run the program PRFPRINT
  60. with the name of the program .MAP file as its argument. This  will 
  61. give the percentage time spent in each of the routines.  There may be
  62. some inaccuraccies because of the eight byte block spanning the boundary 
  63. between two routines, in which case all the time will be allocated to the
  64. routine occurring lower in memory.  This is a statistical test and so
  65. programs running for a short period of time will not be accurately profiled.
  66. The moral of this is to let the thing repeat several times over a period
  67. of many seconds (minutes?)
  68.  
  69.