home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CLIPB52.ZIP / YELLICK.ZIP / PRODEMO.PRG next >
Encoding:
Text File  |  1990-06-05  |  2.4 KB  |  104 lines

  1. *===============================================================*
  2. *
  3. *   ProDemo.Prg:  Demonstration of a PROFILER.
  4. *
  5. *        Author:  Craig Yellick, Alto Microcomputer, Inc.
  6. *                 7107 Ohms Lane, Minneapolis, Minnesota 55435
  7. *                 Voice (612) 835-1080; CIS 76247,541
  8. *
  9. *          Note:  Uses Clipper 5.0-specific syntax.
  10. *
  11. *  Compile PROFILER.PRG and PRODEMO.PRG, then link:
  12. *
  13. *  rtlink file prodemo, profiler lib clipper, extend
  14. *
  15. *---------------------------------------------------------------*
  16. *
  17. *  No copyrights, no restrictions, no nothin'.
  18. *
  19. *---------------------------------------------------------------*
  20.  
  21. ***  Delete this definition to have preprocessor remove
  22. *    calls to PROFILE()
  23. *
  24. #define TESTING
  25.  
  26. #ifdef TESTING
  27.   #define PROFILE(comment)  Profile(comment, ;
  28.                             procname(), procline(), readvar())
  29. #endif
  30. #ifndef TESTING
  31.   #define PROFILE()
  32. #endif
  33.  
  34. ***  Let's get things rolling by taking a snap shot
  35. *    of our start-up conditions.
  36. *
  37. Profile("Initial Load From DOS")
  38.  
  39.  
  40. @ 0,0 clear
  41. @ 1,0 say "ProDemo.Exe:  Demonstration of a PROFILER by Craig Yellick."
  42.  
  43.  
  44. ***  Designate a "hot-key" to call the profiler
  45. *    from any wait-state.
  46. *
  47. set key 376 to PrfKey  // 376 is Alt-1
  48.  
  49.  
  50. ***  Watch the available memory drop as this
  51. *    function is called repeatedly.
  52. *
  53. @ 4,0 say "Calling a memory-chewing function 20 times..."
  54. @ 5,0
  55. for i= 1 to 20
  56.   ?? chr(250)
  57.   Hog(ltrim(str(i)))
  58. next i
  59.  
  60.  
  61. @ 7,0 say "Inserting a few manual calls to the profiler..."
  62. PROFILE("First manual call")
  63. PROFILE("Another manual call")
  64.  
  65.  
  66. ***  Since we established a "hot-key", pressing it
  67. *    during the READ will create an entry in the
  68. *    profiler output file.
  69. *
  70. abc= space(10)
  71. @ 8, 0 say "Press ENTER to continue."
  72. @ 9, 0 say "Press ALT-1 to invoke profiler via hot-key. " get abc
  73. read
  74.  
  75.  
  76. ***  Make a few more calls before exiting
  77. *
  78. Hog("X")
  79. Hog("Y")
  80. Hog("Z")
  81.  
  82. @ 11, 0 say "The file PROFILER.TXT contains the results of this demonstration."
  83. @ 12, 0 say "Exiting to DOS."
  84. @ 14, 0
  85.  
  86. PROFILE("Exiting to DOS")
  87.  
  88. quit
  89.  
  90. * end proc ProDemo2
  91. *---------------------------------------------------------------*
  92.  
  93. function Hog
  94. *
  95. *  A function that chews up memory.
  96. *
  97. parameter c
  98. public hog_&c.
  99. hog_&c.= space(2500)
  100. return ""
  101.  
  102. *===============================================================*
  103. * eof ProDemo2.Prg
  104.