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