Back to index

glibc  2.9
gmon_out.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by David Mosberger <davidm@cs.arizona.edu>.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /* This file specifies the format of gmon.out files.  It should have
00021    as few external dependencies as possible as it is going to be included
00022    in many different programs.  That is, minimize the number of #include's.
00023 
00024    A gmon.out file consists of a header (defined by gmon_hdr) followed by
00025    a sequence of records.  Each record starts with a one-byte tag
00026    identifying the type of records, followed by records specific data. */
00027 
00028 #ifndef _SYS_GMON_OUT_H
00029 #define _SYS_GMON_OUT_H     1
00030 
00031 #include <features.h>
00032 
00033 #define       GMON_MAGIC    "gmon" /* magic cookie */
00034 #define GMON_VERSION 1      /* version number */
00035 
00036 /* For profiling shared object we need a new format.  */
00037 #define GMON_SHOBJ_VERSION  0x1ffff
00038 
00039 __BEGIN_DECLS
00040 
00041 /*
00042  * Raw header as it appears on file (without padding).  This header
00043  * always comes first in gmon.out and is then followed by a series
00044  * records defined below.
00045  */
00046 struct gmon_hdr
00047   {
00048     char cookie[4];
00049     char version[4];
00050     char spare[3 * 4];
00051   };
00052 
00053 /* types of records in this file: */
00054 typedef enum
00055   {
00056     GMON_TAG_TIME_HIST = 0,
00057     GMON_TAG_CG_ARC = 1,
00058     GMON_TAG_BB_COUNT = 2
00059   } GMON_Record_Tag;
00060 
00061 struct gmon_hist_hdr
00062   {
00063     char low_pc[sizeof (char *)];  /* base pc address of sample buffer */
00064     char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */
00065     char hist_size[4];                    /* size of sample buffer */
00066     char prof_rate[4];                    /* profiling clock rate */
00067     char dimen[15];                /* phys. dim., usually "seconds" */
00068     char dimen_abbrev;                    /* usually 's' for "seconds" */
00069   };
00070 
00071 struct gmon_cg_arc_record
00072   {
00073     char from_pc[sizeof (char *)]; /* address within caller's body */
00074     char self_pc[sizeof (char *)]; /* address within callee's body */
00075     char count[4];                 /* number of arc traversals */
00076   };
00077 
00078 __END_DECLS
00079 
00080 #endif /* sys/gmon_out.h */