home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Perf.p < prev    next >
Encoding:
Text File  |  1993-11-30  |  3.1 KB  |  109 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Perf.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.     UNIT Perf;
  18.     INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPerf}
  22. {$SETC UsingPerf := 1}
  23.  
  24. {$I+}
  25. {$SETC PerfIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$SETC UsingIncludes := PerfIncludes}
  31.  
  32. TYPE
  33.  
  34. PLongs = ^ALongs;
  35. ALongs = ARRAY [1..8000] OF LONGINT;
  36.  
  37. PInts = ^AInts;
  38. HInts = ^PInts;
  39.  
  40. AInts = ARRAY [1..8000] OF INTEGER;
  41.  
  42. { PerfGlobals are declared as a record, so main program can allocate
  43. as globals, desk accessory can add to globals allocated via pointer,
  44. print driver can allocate via low memory, etc. }
  45.  
  46.  
  47. TP2PerfGlobals = ^TPerfGlobals;
  48. TPerfGlobals = RECORD
  49.     startROM: LONGINT;            {ROM Base}
  50.     romHits: LONGINT;            {used if MeasureROM is false}
  51.     misses: LONGINT;            {count of PC values outside measured memory}
  52.     segArray: PLongs;            {array of segment handles}
  53.     sizeArray: PLongs;            {array of segment sizes}
  54.     idArray: HInts;             {array of segment rsrc IDs}
  55.     baseArray: PLongs;            {array of offsets to counters for each segment}
  56.     samples: PLongs;            {samples buffer}
  57.     buffSize: LONGINT;            {size of samples buffer in bytes}
  58.     timeInterval: INTEGER;        {number of clock intervals between interrupts}
  59.     bucketSize: INTEGER;        {size of buckets power of 2}
  60.     log2buckSize: INTEGER;        {used in CvtPC}
  61.     pcOffset: INTEGER;            {offset to the user PC at interrupt time.}
  62.     numMeasure: INTEGER;        {# Code segments (w/o jump table)- ROM etc.}
  63.     firstCode: INTEGER;         {index of first Code segment}
  64.     takingSamples: BOOLEAN;     {true if sampling is enabled}
  65.     measureROM: BOOLEAN;
  66.     measureCode: BOOLEAN;
  67.     ramSeg: INTEGER;            {index of "segment" record to cover RAM > 0 if RAM (misses) are to be bucketed.}
  68.     ramBase: LONGINT;            {beginning of RAM being measured.}
  69.     measureRAMbucketSize: INTEGER;
  70.     measureRAMlog2buckSize: INTEGER;
  71.     romVersion: INTEGER;
  72.     vRefNum: INTEGER;            {Volume where the report file is to be created}
  73.     volumeSelected: BOOLEAN;    {True if user selects the report file name}
  74.     rptFileName: Str255;        {Report file name}
  75.     rptFileCreator: Str255;     {Report File Creator}
  76.     rptFileType: Str255;        {Report File type}
  77.     getResType: ResType;        {Resource type}
  78.     END;
  79.  
  80.  
  81.  
  82. FUNCTION InitPerf(VAR thePerfGlobals: TP2PerfGlobals;timerCount: INTEGER;
  83.     codeAndROMBucketSize: INTEGER;doROM: BOOLEAN;doAppCode: BOOLEAN;appCodeType: Str255;
  84.     romID: INTEGER;romName: Str255;doRAM: BOOLEAN;ramLow: LONGINT;ramHigh: LONGINT;
  85.     ramBucketSize: INTEGER): BOOLEAN;
  86. { called once to setup Performance monitoring
  87.  }
  88.  
  89. PROCEDURE TermPerf(thePerfGlobals: TP2PerfGlobals);
  90. { if InitPerf succeeds then TermPerf must be called before terminating program.
  91.  }
  92.  
  93. FUNCTION PerfControl(thePerfGlobals: TP2PerfGlobals;turnOn: BOOLEAN): BOOLEAN;
  94. { Call this to turn off/on measuring.
  95.  Returns previous state.
  96.  }
  97.  
  98. FUNCTION PerfDump(thePerfGlobals: TP2PerfGlobals;reportFile: Str255;doHistogram: BOOLEAN;
  99.     rptFileColumns: INTEGER): INTEGER;
  100. { Call this to dump the statistics into a file. }
  101.  
  102.  
  103. {$ENDC}    { UsingPerf }
  104.  
  105. {$IFC NOT UsingIncludes}
  106.     END.
  107. {$ENDC}
  108.  
  109.