xref: /illumos-gate/usr/src/cmd/sgs/include/monv.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_MONV_H
28 #define	_MONV_H
29 
30 /*
31  * Versioned monitor file
32  *
33  * Since this is not really a *shared* file between the compilers and OS
34  * (each hold a separate copy), care must be taken to see that it is in
35  * in sync with the compiler version.
36  */
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  *	General object structure
44  */
45 #ifndef	PROF_TYPES_PREDEFINED
46 typedef unsigned long long Index;
47 typedef unsigned long long Address;
48 typedef unsigned long long Size;
49 #endif
50 
51 typedef struct _prof_object {
52 	unsigned int		type;
53 	unsigned int		version;
54 	Size			size;
55 } ProfObject;
56 
57 
58 #define	PROF_MAGIC		0x50524F46	/* "PROF" */
59 #define	PROF_MAJOR_VERSION	1
60 #define	PROF_MINOR_VERSION	0
61 
62 typedef struct _prof_header {
63 	unsigned int		h_magic;
64 	unsigned short		h_major_ver;
65 	unsigned short		h_minor_ver;
66 	Size			size;
67 } ProfHeader;
68 
69 /*
70  *	Object types
71  */
72 #define	PROF_DUMMY_T		-1		/* to be ignored by gprof */
73 #define	PROF_BUFFER_T		1
74 #define	PROF_CALLGRAPH_T	2
75 #define	PROF_MODULES_T		3
76 
77 /*
78  *	Object version numbers
79  */
80 #define	PROF_BUFFER_VER		1
81 #define	PROF_CALLGRAPH_VER	1
82 #define	PROF_MODULES_VER	1
83 
84 /*
85  * Actual number of pcsample elements that can be held in 1Mb with
86  * the size of (Address) equal to 8
87  */
88 #define	PROF_BUFFER_SIZE	131072		/* 1 Mb */
89 
90 typedef struct _prof_buffer {
91 	unsigned int		type;		/* PROF_BUFFER_T */
92 	unsigned int		version;	/* 1 */
93 	Size			size;
94 	Index			buffer;
95 	Size			bufsize;
96 } ProfBuffer;
97 
98 typedef struct _prof_call_graph {
99 	unsigned int		type;		/* PROF_CALLGRAPH_T */
100 	unsigned int		version;	/* 1 */
101 	Size			size;
102 	Index			functions;
103 } ProfCallGraph;
104 
105 typedef struct _prof_module_list {
106 	unsigned int		type;		/* PROF_MODULES_T */
107 	unsigned int		version;	/* 1 */
108 	Size			size;
109 	Index			modules;
110 } ProfModuleList;
111 
112 typedef struct _prof_module {
113 	Index			next;
114 	Index			path;
115 	Address			startaddr;
116 	Address			endaddr;
117 } ProfModule;
118 
119 typedef struct _prof_function {
120 	Index			next_to;
121 	Index			next_from;
122 	Address			frompc;
123 	Address			topc;
124 	unsigned long long	count;
125 	Index			next_hash;
126 } ProfFunction;
127 
128 #ifdef	__cplusplus
129 }
130 #endif
131 
132 #endif	/* _MONV_H */
133