home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / source / sprofpriv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-24  |  2.4 KB  |  88 lines

  1. /*-------------------------------------------------------------------*/
  2. /* Copyright (c) 1993 by SAS Institute Inc., Cary NC                 */
  3. /* All Rights Reserved                                               */
  4. /*                                                                   */
  5. /* SUPPORT:    walker - Doug Walker                                  */
  6. /*-------------------------------------------------------------------*/
  7. #define __USE_SYSBASE 1
  8. #include <exec/types.h>
  9. #include <dos/doshunks.h>
  10. #include <time.h>
  11.  
  12. #define TIMERINTERVAL 5000   /* in milliseconds */
  13.  
  14. #if DODEBUG
  15. #include <stdarg.h>
  16. #include <stdio.h>
  17. #define BUG(x) {if(dodebug) bug x ;}
  18. void bug(char *fmt, ...);
  19. static int dodebug;
  20. #define FUNCENTRY BUG((__FUNC__ ": entry\n"))
  21. #else
  22. #define BUG(x)
  23. #define FUNCENTRY
  24. #endif
  25.  
  26. #define SPROFPORT "SPROF_Profiler"
  27.  
  28. typedef unsigned long sptime;
  29.  
  30. struct SPDAT
  31. {
  32.    char *id;        // id of function (NULL for ignore)
  33.    sptime clk;      // Clock at entry
  34.    sptime subrs;    // Amount of time spent in subroutines
  35.    sptime off;      // Amount of time under PROFILE_OFF
  36. };
  37. #define SIZSPDAT sizeof(struct SPDAT)
  38.  
  39. extern struct SPDAT *spdat;
  40. extern int spcur, spmax;
  41. #define SPINCR 500
  42.  
  43. typedef struct SPROFMSG
  44. {
  45.    struct Message m;
  46.    ULONG process;
  47.    sptime clk;
  48.    char *id;
  49.    ULONG a7;
  50.    ULONG flags;
  51. } *SPM;
  52.  
  53. #define SIZSPM sizeof(struct SPROFMSG)
  54.  
  55. /* Values for the 'flags' field of SPROFMSG */
  56. #define SPROF_INIT   0x00000001  // Initialize connection
  57. #define SPROF_ENTRY  0x00000002  // Function entry
  58. #define SPROF_EXIT   0x00000004  // Function exit
  59. #define SPROF_TERM   0x00000008  // Terminate connection, program continues
  60. #define SPROF_ABORT  0x00000010  // Abort program
  61. #define SPROF_DENIED 0x00000020  // Connection refused
  62.  
  63. struct GPInfo
  64. {
  65.    char *id;       // Used for sorting while program is in mem
  66.    char *name;     // Name of function
  67.    sptime time;    // Time excluding subroutines
  68.    sptime tottime; // Time including subroutines
  69.    ULONG count;    // Number of calls
  70. };
  71.  
  72. extern struct GPInfo **GPInfo;
  73. extern int GPCur, GPMax;
  74. #define SIZGPINFO sizeof(struct GPInfo)
  75. #define GPINCR 256
  76.  
  77. void Report(sptime now);
  78. struct GPInfo *FindGPI(struct GPInfo ***GPInfo, char *id,
  79.                        int *cur, int *tot);
  80.  
  81. /* Functions defined in timer.c */
  82. long OpenTimer(void);
  83. void _STDCloseTimer(void);
  84. #define CloseTimer() _STDCloseTimer()
  85. void PostTimerReq(long time);
  86. void GetTimerPkt(long time, int wait);
  87.  
  88.