xref: /titanic_50/usr/src/cmd/sgs/include/monv.h (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Versioned monitor file
34  *
35  * Since this is not really a *shared* file between the compilers and OS
36  * (each hold a separate copy), care must be taken to see that it is in
37  * in sync with the compiler version.
38  */
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  *	General object structure
46  */
47 #ifndef	PROF_TYPES_PREDEFINED
48 typedef unsigned long long Index;
49 typedef unsigned long long Address;
50 typedef unsigned long long Size;
51 #endif
52 
53 typedef struct _prof_object {
54 	unsigned int		type;
55 	unsigned int		version;
56 	Size			size;
57 } ProfObject;
58 
59 
60 #define	PROF_MAGIC		0x50524F46	/* "PROF" */
61 #define	PROF_MAJOR_VERSION	1
62 #define	PROF_MINOR_VERSION	0
63 
64 typedef struct _prof_header {
65 	unsigned int		h_magic;
66 	unsigned short		h_major_ver;
67 	unsigned short		h_minor_ver;
68 	Size			size;
69 } ProfHeader;
70 
71 /*
72  *	Object types
73  */
74 #define	PROF_DUMMY_T		-1		/* to be ignored by gprof */
75 #define	PROF_BUFFER_T		1
76 #define	PROF_CALLGRAPH_T	2
77 #define	PROF_MODULES_T		3
78 
79 /*
80  *	Object version numbers
81  */
82 #define	PROF_BUFFER_VER		1
83 #define	PROF_CALLGRAPH_VER	1
84 #define	PROF_MODULES_VER	1
85 
86 /*
87  * Actual number of pcsample elements that can be held in 1Mb with
88  * the size of (Address) equal to 8
89  */
90 #define	PROF_BUFFER_SIZE	131072		/* 1 Mb */
91 
92 typedef struct _prof_buffer {
93 	unsigned int		type;		/* PROF_BUFFER_T */
94 	unsigned int		version;	/* 1 */
95 	Size			size;
96 	Index			buffer;
97 	Size			bufsize;
98 } ProfBuffer;
99 
100 typedef struct _prof_call_graph {
101 	unsigned int		type;		/* PROF_CALLGRAPH_T */
102 	unsigned int		version;	/* 1 */
103 	Size			size;
104 	Index			functions;
105 } ProfCallGraph;
106 
107 typedef struct _prof_module_list {
108 	unsigned int		type;		/* PROF_MODULES_T */
109 	unsigned int		version;	/* 1 */
110 	Size			size;
111 	Index			modules;
112 } ProfModuleList;
113 
114 typedef struct _prof_module {
115 	Index			next;
116 	Index			path;
117 	Address			startaddr;
118 	Address			endaddr;
119 } ProfModule;
120 
121 typedef struct _prof_function {
122 	Index			next_to;
123 	Index			next_from;
124 	Address			frompc;
125 	Address			topc;
126 	unsigned long long	count;
127 	Index			next_hash;
128 } ProfFunction;
129 
130 #ifdef	__cplusplus
131 }
132 #endif
133 
134 #endif	/* _MONV_H */
135