1 // Slightly adapted from OpenBSD "/src/gnu/usr.bin/binutils/gprof/gmon_out.h"
2 // for eCos environment
5 * This file specifies the format of gmon.out files. It should have
6 * as few external dependencies as possible as it is going to be
7 * included in many different programs. That is, minimize the
8 * number of #include's.
10 * A gmon.out file consists of a header (defined by gmon_hdr) followed
11 * by a sequence of records. Each record starts with a one-byte tag
12 * identifying the type of records, followed by records specific data.
17 #include <cyg/infra/cyg_type.h>
19 #define GMON_MAGIC "gmon" /* magic cookie */
20 #define GMON_VERSION 1 /* version number */
23 * Raw header as it appears on file (without padding):
28 char version[4]; // a cyg_uint32, target-side endianness
32 /* types of records in this file: */
35 GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
39 /* The histogram tag is followed by this header, and then an array of */
40 /* cyg_uint16's for the actual counts. */
44 /* host-side gprof adapts to sizeof(void*) and endianness. */
45 /* It is assumed that the compiler does not insert padding around the */
46 /* cyg_uint32's or the char arrays. */
47 void* low_pc; /* base pc address of sample buffer */
48 void* high_pc; /* max pc address of sampled buffer */
49 cyg_uint32 hist_size; /* size of sample buffer */
50 cyg_uint32 prof_rate; /* profiling clock rate */
51 char dimen[15]; /* phys. dim., usually "seconds" */
52 char dimen_abbrev; /* usually 's' for "seconds" */
55 /* An arc tag is followed by a single arc record. self_pc corresponds to */
56 /* the location of an mcount() call, at the start of a function. from_pc */
57 /* corresponds to the return address, i.e. where the function was called */
58 /* from. count is the number of calls. */
60 struct gmon_cg_arc_record
62 void* from_pc; /* address within caller's body */
63 void* self_pc; /* address within callee's body */
64 cyg_uint32 count; /* number of arc traversals */
67 /* In theory gprof can also process basic block counts, as per the */
68 /* compiler's -fprofile-arcs flag. The compiler-generated basic block */
69 /* structure should contain a table of addresses and a table of counts, */
70 /* and the compiled code updates those counts. Current versions of the */
71 /* compiler (~3.2.1) do not output the table of addresses, and without */
72 /* that table gprof cannot process the counts. Possibly gprof should read */
73 /* in the .bb and .bbg files generated for gcov processing, but that does */
74 /* not happen at the moment. */
76 /* So for now gmon.out does not contain basic block counts and gprof */
77 /* operations that depend on it, e.g. --annotated-source, won't work. */
79 #endif /* gmon_out_h */