source: vendor/emx/current/src/os2/profil.h

Last change on this file was 18, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.1 KB
Line 
1/* profil.h -- written by Holger Veit, donated to the public domain */
2
3typedef ULONG DWORD;
4typedef USHORT WORD;
5
6#define PRF_CM_INIT 0 /* initialize, must pass pid and profcmd */
7#define PRF_CM_START 1 /* start profiling (pid) */
8#define PRF_CM_STOP 2 /* stop profiling (pid) */
9#define PRF_CM_CLEAR 3 /* clear profile counters (pid) */
10#define PRF_CM_DUMP 4 /* read out profiling data (pid, profret) */
11#define PRF_CM_EXIT 5 /* exit profiling, delete profiling structures */
12
13#pragma pack(1)
14
15typedef struct {
16 DWORD sl_vaddr; /* start of VA segment to profile */
17 DWORD sl_size; /* length of VA segment */
18 DWORD sl_mode; /* !=0 use PRF_VA* flags, */
19 /* =0, simple count */
20#define PRF_SL_SIMPCNT 0
21#define PRF_SL_PRFVA 1
22
23} PRFSLOT;
24
25typedef struct {
26 PRFSLOT *cm_slots; /* Virtual address slots */
27 WORD cm_nslots; /* # of VA slots < 256 (!) */
28 WORD cm_flags; /* command */
29#define PRF_PROCESS_MT 0 /* profile proc+threads */
30#define PRF_PROCESS_ST 1 /* profile proc only */
31#define PRF_KERNEL 2 /* profile kernel */
32
33#define PRF_VADETAIL 0 /* create detailed page counters */
34#define PRF_VAHIT 4 /* create hit table */
35#define PRF_VATOTAL 8 /* create total count for VA only */
36
37#define PRF_FLGBITS 0x40 /* has a flgbits structure (?) */
38#define PRF_WRAP 0x80 /* don't use: if hit table full, wrap */
39 /* there is a bug in kernel, which */
40 /* prevents this from correct working! */
41
42/* status bits, don't ever set these (won't work, not masked, bug!) */
43#define PRFS_RUNNING 0x100 /* profiling is active */
44#define PRFS_THRDS 0x200 /* also profiling threads */
45#define PRFS_HITOVFL 0x800 /* overflow in hit buffer */
46#define PRFS_HEADER 0x1000 /* internally used */
47
48 DWORD cm_bufsz; /* reserve # of bytes for buffers */
49 /* e.g. for hit buffer or detailed */
50 /* counters */
51 WORD cm_timval; /* timer resolution */
52 /* if 0, use default == 1000 */
53 /* valid if PRF_FLAGBITS set */
54 BYTE* cm_flgbits; /* vector of flag bits (?) */
55 BYTE cm_nflgs; /* # of flag bits >= 2 if present */
56} PRFCMD; /* 19 bytes */
57
58typedef struct {
59 DWORD va_vaddr; /* virtual address of segment */
60 DWORD va_size; /* length of segment */
61 DWORD va_flags; /* == 8, va_cnt is valid */
62 DWORD va_reserved; /* internally used */
63 DWORD va_cnt; /* profile count */
64} PRFVA;
65
66typedef struct {
67 BYTE us_cmd; /* command */
68#define PRF_RET_GLOBAL 0 /* return global data */
69 /* set us_thrdno for specific thread */
70 /* us_buf = struct PRFRET0 */
71#define PRF_RET_VASLOTS 1 /* return VA slot data (PRFRET1) */
72#define PRF_RET_VAHITS 2 /* return hit table (PRFRET2) */
73#define PRF_RET_VADETAIL 3 /* return detailed counters (PRFRET3) */
74 /* specify us_vaddr */
75
76 WORD us_thrdno; /* thread requested for cmd=0 */
77 DWORD us_vaddr; /* VA for cmd=3*/
78 DWORD us_bufsz; /* length of return buffer */
79 VOID *us_buf; /* return buffer */
80} PRFRET; /* 15 bytes */
81
82typedef struct {
83 WORD r0_flags; /* profile flags */
84 /* see PRF_* defines */
85 BYTE r0_shift; /* shift factor */
86 /* 2^N = length of a segment for */
87 /* detailed counters */
88 DWORD r0_idle; /* count if process is idle */
89 DWORD r0_vm86; /* count if process is in VM mode */
90 DWORD r0_kernel; /* count if process is in kernel */
91 DWORD r0_shrmem; /* count if process is in shr mem */
92 DWORD r0_unknown; /* count if process is elsewhere */
93 DWORD r0_nhitbufs; /* # of dwords in hitbufs */
94 DWORD r0_hitbufcnt; /* # of entries in hit table */
95 DWORD r0_reserved1; /* internally used */
96 DWORD r0_reserved2; /* internally used */
97 WORD r0_timval; /* timer resolution */
98 BYTE r0_errcnt; /* error count */
99 WORD r0_nstruc1; /* # of add structures 1 (?) */
100 WORD r0_nstruc2; /* # of add structures 2 (?) */
101} PRFRET0;
102
103typedef struct {
104 BYTE r1_nslots; /* # of slots (bug: prevents */
105 /* correct # if #slots >255) */
106 PRFVA r1_slots[1]; /* slots */
107} PRFRET1;
108
109typedef struct {
110 DWORD r2_nhits; /* # of entries in table */
111 DWORD r2_hits[1]; /* hit table */
112} PRFRET2;
113
114typedef struct {
115 DWORD r3_size; /* size of segment */
116 DWORD r3_ncnts; /* # of entries in table */
117 DWORD r3_cnts[1]; /* counters */
118} PRFRET3;
119
120#pragma pack()
121
122ULONG DosProfile (DWORD func, PID pid, PRFCMD *profcmd, PRFRET *profret);
Note: See TracBrowser for help on using the repository browser.