OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [services/] [profile/] [gprof/] [current/] [include/] [gmon_out.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// Slightly adapted from OpenBSD "/src/gnu/usr.bin/binutils/gprof/gmon_out.h"
2
// for eCos environment
3
 
4
/*
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.
9
 *
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.
13
 */
14
#ifndef gmon_out_h
15
#define gmon_out_h
16
 
17
#include <cyg/infra/cyg_type.h>
18
 
19
#define GMON_MAGIC      "gmon"  /* magic cookie */
20
#define GMON_VERSION    1       /* version number */
21
 
22
/*
23
 * Raw header as it appears on file (without padding):
24
 */
25
struct gmon_hdr
26
{
27
    char cookie[4];
28
    char version[4];    // a cyg_uint32, target-side endianness
29
    char spare[3 * 4];
30
};
31
 
32
/* types of records in this file: */
33
typedef enum
34
{
35
    GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
36
}
37
GMON_Record_Tag;
38
 
39
/* The histogram tag is followed by this header, and then an array of       */
40
/* cyg_uint16's for the actual counts.                                      */
41
 
42
struct gmon_hist_hdr
43
{
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"            */
53
};
54
 
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.                                      */
59
 
60
struct gmon_cg_arc_record
61
{
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             */
65
};
66
 
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.                                                */
75
/*                                                                          */
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.       */
78
 
79
#endif /* gmon_out_h */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.