1 | /* Copyright (C) 1996-2021 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. |
3 | Contributed by David Mosberger <davidm@cs.arizona.edu>. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | /* This file specifies the format of gmon.out files. It should have |
20 | as few external dependencies as possible as it is going to be included |
21 | in many different programs. That is, minimize the number of #include's. |
22 | |
23 | A gmon.out file consists of a header (defined by gmon_hdr) followed by |
24 | a sequence of records. Each record starts with a one-byte tag |
25 | identifying the type of records, followed by records specific data. */ |
26 | |
27 | #ifndef _SYS_GMON_OUT_H |
28 | #define _SYS_GMON_OUT_H 1 |
29 | |
30 | #include <features.h> |
31 | |
32 | #define GMON_MAGIC "gmon" /* magic cookie */ |
33 | #define GMON_VERSION 1 /* version number */ |
34 | |
35 | /* For profiling shared object we need a new format. */ |
36 | #define GMON_SHOBJ_VERSION 0x1ffff |
37 | |
38 | __BEGIN_DECLS |
39 | |
40 | /* |
41 | * Raw header as it appears on file (without padding). This header |
42 | * always comes first in gmon.out and is then followed by a series |
43 | * records defined below. |
44 | */ |
45 | struct gmon_hdr |
46 | { |
47 | char cookie[4]; |
48 | char version[4]; |
49 | char spare[3 * 4]; |
50 | }; |
51 | |
52 | /* types of records in this file: */ |
53 | typedef enum |
54 | { |
55 | GMON_TAG_TIME_HIST = 0, |
56 | GMON_TAG_CG_ARC = 1, |
57 | GMON_TAG_BB_COUNT = 2 |
58 | } GMON_Record_Tag; |
59 | |
60 | struct gmon_hist_hdr |
61 | { |
62 | char low_pc[sizeof (char *)]; /* base pc address of sample buffer */ |
63 | char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */ |
64 | char hist_size[4]; /* size of sample buffer */ |
65 | char prof_rate[4]; /* profiling clock rate */ |
66 | char dimen[15]; /* phys. dim., usually "seconds" */ |
67 | char dimen_abbrev; /* usually 's' for "seconds" */ |
68 | }; |
69 | |
70 | struct gmon_cg_arc_record |
71 | { |
72 | char from_pc[sizeof (char *)]; /* address within caller's body */ |
73 | char self_pc[sizeof (char *)]; /* address within callee's body */ |
74 | char count[4]; /* number of arc traversals */ |
75 | }; |
76 | |
77 | __END_DECLS |
78 | |
79 | #endif /* sys/gmon_out.h */ |
80 | |