profv.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SGS_PROFV_H
#define _SGS_PROFV_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Header file for processing versioned, *new-style* mon.out files.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "gelf.h"
#include "monv.h"
/*
* Booleans.
*/
typedef int bool;
#define TRUE 1
#define FALSE 0
/*
* Bit macro and flag bit definitions. These and the sort_flags below,
* need to be always in sync with the set in prof.c
*/
extern int flags;
#define F_SORT 0x1
#define F_VERBOSE 0x2
#define F_ZSYMS 0x4
#define F_PADDR 0x8
#define F_NHEAD 0x10
/*
* Sort flags. Mutually exclusive.
*/
extern unsigned char sort_flag;
#define BY_ADDRESS 0x1
#define BY_NCALLS 0x2
#define BY_NAME 0x4
#define BY_TIME 0x8
/*
* Error codes
*/
#define ERR_SYSCALL 1
#define ERR_INPUT 2
#define ERR_ELF 3
#define ERR_MEMORY 4
/*
* Other useful macros.
*/
#define BUCKET_SZ 4096
#define PRF_END "_end"
/*
* Module info.
*/
struct mod_info {
char *path; /* pathname of module */
int id; /* id (used while printing) */
bool active; /* is this module active or not ? */
};
typedef struct mod_info mod_info_t;
/*
* List of shared objects. Note that this always includes the program
* executable as the first element.
*/
extern mod_info_t modules;
/*
* The symbol table.
*/
struct nl {
char *name; /* name of the symbol */
};
/*
* The profile output record. There is some duplication of fields from
* the namelist, but the profsym contains just the symbols we're going
* to print, and that makes a lot of things easier.
*/
struct profrec {
double percent_time; /* percentage time spent here */
double seconds; /* time spent here in seconds */
double msecs_per_call; /* milliseconds per call */
char *demangled_name; /* demangled name if C++ */
bool print_mid; /* print module id ? */
char *name; /* bookkeeping, not printed */
};
/*
* Names in profile output need to be sorted to figure out if there'll
* be any duplicate names in the output.
*/
struct profnames {
char *name;
};
typedef struct profnames profnames_t;
/*
* st_info is the same size (1 byte) in both ELF64 and ELF32
*/
/*
* File status.
*/
/*
* Timing related externs.
*/
extern bool time_in_ticks;
extern double total_time;
/*
* Imported declarations
*/
extern char *sgs_demangle(char *);
/*
* Other declarations
*/
extern void profver(void);
extern void get_syms(char *, mod_info_t *);
extern bool is_shared_obj(char *);
#ifdef __cplusplus
}
#endif
#endif /* _SGS_PROFV_H */