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