4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Header file for processing versioned, *new-style* mon.out files.
41 #include <sys/types.h>
60 * Bit macro and flag bit definitions. These and the sort_flags below,
61 * need to be always in sync with the set in prof.c
72 * Sort flags. Mutually exclusive.
74 extern unsigned char sort_flag
;
76 #define BY_ADDRESS 0x1
90 * Other useful macros.
92 #define BUCKET_SZ 4096
93 #define PRF_END "_end"
95 extern int gflag
, Cflag
;
96 extern char *atitle
, *aformat
,
97 *cmdname
, *sym_fn
, *mon_fn
;
103 char *path
; /* pathname of module */
104 int id
; /* id (used while printing) */
105 bool active
; /* is this module active or not ? */
106 Address load_base
; /* base addr where module is loaded */
107 Address load_end
; /* end addr of loaded module */
108 GElf_Addr txt_origin
; /* txt start as given in PHT */
109 GElf_Addr data_end
; /* data end as found from `_end' */
110 struct nl
*nl
; /* ptr to module's namelist */
111 size_t nfuncs
; /* number of functions in `nl' */
112 struct mod_info
*next
; /* link to next module */
114 typedef struct mod_info mod_info_t
;
117 * List of shared objects. Note that this always includes the program
118 * executable as the first element.
120 extern mod_info_t modules
;
121 extern size_t n_modules
;
127 char *name
; /* name of the symbol */
128 GElf_Addr value
; /* value of the symbol */
129 unsigned char info
; /* symbol's bind/type info */
130 GElf_Xword size
; /* size of the symbol */
131 size_t ncalls
; /* number of calls to this func */
132 size_t nticks
; /* number of ticks spent here */
134 typedef struct nl nltype
;
137 * The profile output record. There is some duplication of fields from
138 * the namelist, but the profsym contains just the symbols we're going
139 * to print, and that makes a lot of things easier.
142 GElf_Addr addr
; /* symbol value */
143 double percent_time
; /* percentage time spent here */
144 double seconds
; /* time spent here in seconds */
145 size_t ncalls
; /* calls to this function */
146 double msecs_per_call
; /* milliseconds per call */
147 char *demangled_name
; /* demangled name if C++ */
148 bool print_mid
; /* print module id ? */
149 char *name
; /* bookkeeping, not printed */
150 mod_info_t
*module
; /* bookkeeping, not printed */
152 typedef struct profrec profrec_t
;
153 extern profrec_t
*profsym
;
156 * Names in profile output need to be sorted to figure out if there'll
157 * be any duplicate names in the output.
163 typedef struct profnames profnames_t
;
168 extern struct stat aout_stat
, monout_stat
;
171 * Timing related externs.
173 extern bool time_in_ticks
;
174 extern size_t n_pcsamples
, n_accounted_ticks
, n_zeros
, total_funcs
;
175 extern double total_time
;
180 extern void profver(void);
181 extern nltype
*nllookup(mod_info_t
*, Address
, Address
*);
182 extern Address
*locate(Address
*, size_t, Address
);
183 extern void get_syms(char *, mod_info_t
*);
184 extern int cmp_by_address(const void *arg1
, const void *arg2
);
185 extern bool is_shared_obj(char *);
191 #endif /* _SGS_PROFV_H */