Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / shark / include / profileio.h
blob8f08f5e97248ad13b507f437448ee7a83e0844bb
1 /* $NetBSD$ */
3 /*
4 * Copyright 1997
5 * Digital Equipment Corporation. All rights reserved.
7 * This software is furnished under license and may be used and
8 * copied only in accordance with the following terms and conditions.
9 * Subject to these conditions, you may download, copy, install,
10 * use, modify and distribute this software in source and/or binary
11 * form. No title or ownership is transferred hereby.
13 * 1) Any source code used, modified or distributed must reproduce
14 * and retain this copyright notice and list of conditions as
15 * they appear in the source file.
17 * 2) No right is granted to use any trade name, trademark, or logo of
18 * Digital Equipment Corporation. Neither the "Digital Equipment
19 * Corporation" name nor any trademark or logo of Digital Equipment
20 * Corporation may be used to endorse or promote products derived
21 * from this software without the prior written permission of
22 * Digital Equipment Corporation.
24 * 3) This software is provided "AS-IS" and any express or implied
25 * warranties, including but not limited to, any implied warranties
26 * of merchantability, fitness for a particular purpose, or
27 * non-infringement are disclaimed. In no event shall DIGITAL be
28 * liable for any damages whatsoever, and in particular, DIGITAL
29 * shall not be liable for special, indirect, consequential, or
30 * incidental damages or damages for lost profits, loss of
31 * revenue or loss of use, whether such damages arise in contract,
32 * negligence, tort, under statute, in equity, at law or otherwise,
33 * even if advised of the possibility of such damage.
37 * Remote profiler structures used to communicate between the
38 * target (SHARK) and the host (GUI'd) machine.
39 * Also has stuff used to talk between the profiling driver and
40 * profiling server function.
44 #ifndef __PROFILE_IO_H__
45 #define __PROFILE_IO_H__
47 #include <sys/types.h>
49 /* I have no idea what the 'P' group id means,
50 * I presume it isn't used for much.??
52 #define PROFIOSTART _IOWR('P', 0, struct profStartInfo) /* start profiling */
53 #define PROFIOSTOP _IO('P', 1) /* stop profiling */
55 /* hash table stuff.
57 #define TABLE_ENTRY_SIZE (sizeof(struct hashEntry))
58 #define REDUNDANT_BITS 0x02
59 #define COUNT_BITS 0x02
60 #define COUNT_BIT_MASK 0x03
62 /* sample mode flags.
64 #define SAMPLE_MODE_MASK 0x03
65 #define SAMPLE_PROC 0x01
66 #define SAMPLE_KERN 0x02
68 /* an actual entry
70 struct profHashEntry
72 unsigned int pc; /* the pc, minus any redundant bits. */
73 unsigned int next; /* the next pointer as an entry index */
74 unsigned short counts[4]; /* the counts */
77 /* table header.
79 struct profHashHeader
81 unsigned int tableSize; /* total table size in entries */
82 unsigned int entries; /* first level table size, in entries */
83 unsigned int samples; /* the number of samples in the table. */
84 unsigned int missed; /* the number of samples missed. */
85 unsigned int fiqs; /* the number of fiqs. */
86 unsigned int last; /* last entry in the overflow area */
87 pid_t pid; /* The pid being sampled */
88 int mode; /* kernel or user mode */
90 __attribute__ ((packed));
92 /* actual table
94 struct profHashTable
96 struct profHashHeader hdr;
97 struct profHashEntry *entries;
100 /* information passed to the start/stop ioctl.
102 struct profStartInfo
104 pid_t pid; /* if this is -1 sample no processes */
105 unsigned int tableSize; /* the total table size in entries */
106 unsigned int entries; /* number of entries to hash */
107 unsigned int mode; /* if set profile the kernel */
108 int status; /* status of command returned by driver. */
112 /* Communications Protocol stuff
113 * defines the messages that the host and
114 * target will use to communicate.
117 struct packetHeader
119 int code; /* this will either be a command or a
120 * data specifier.
122 unsigned int size; /* size of data to follow,
123 * quantity depends on code.
126 __attribute__ ((packed));
128 struct startSamplingCommand
130 pid_t pid; /* the pid to sample */
131 unsigned int tableSize; /* the total table size in entries */
132 unsigned int entries; /* number of entries to hash */
133 unsigned int mode; /* if set profile kernel also. */
135 __attribute__ ((packed));
137 struct startSamplingResponse
139 int status; /* identifies the status of the command. */
140 int count; /* number of shared lib entries following. */
142 __attribute__ ((packed));
144 struct stopSamplingCommand
146 int alert; /* if set then the daemon sends a SIGINT to
147 * the process.
150 __attribute__ ((packed));
152 struct disassemble
154 unsigned int offset; /* offset into file to begin disassembling */
155 unsigned int length; /* length in arm words ie 32bits. */
157 __attribute__ ((packed));
159 struct profStatus
161 unsigned int status; /* identifies the status. */
163 __attribute__ ((packed));
166 /* Command/Data Types
167 * Only one bit may be set for any one command.
168 * so these are not masks but distinct values.
170 #define START_SAMPLING 0x01
171 #define STOP_SAMPLING 0x02
172 #define READ_TABLE 0x03
173 #define DISASSEMBLY 0x04
174 #define SYMBOL_INFO 0x05
175 #define PROCESS_INFO 0x06
177 /* Data Types */
178 #define TABLE_DATA 0x07
179 #define SYMBOL_DATA 0x08
180 #define DISAS_DATA 0x09
181 #define PROC_DATA 0x0a
182 #define STATUS_DATA 0x0b
183 #define START_DATA 0x0c
185 /* Status Codes */
186 #define CMD_OK 0x00
187 #define ALREADY_SAMPLING 0x01
188 #define NOT_SAMPLING 0x02
189 #define NO_MEMORY 0x03
190 #define BAD_TABLE_SIZE 0x04
191 #define ILLEGAL_PACKET 0x05
192 #define ILLEGAL_COMMAND 0x06
193 #define BAD_OPTION 0x07
195 #endif