Linux Audio

Check our new training course

Loading...
v4.17
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 *  Profiling infrastructure declarations.
 4 *
 5 *  This file is based on gcc-internal definitions. Data structures are
 6 *  defined to be compatible with gcc counterparts. For a better
 7 *  understanding, refer to gcc source: gcc/gcov-io.h.
 8 *
 9 *    Copyright IBM Corp. 2009
10 *    Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
11 *
12 *    Uses gcc-internal data definitions.
13 */
14
15#ifndef GCOV_H
16#define GCOV_H GCOV_H
17
18#include <linux/types.h>
19
20/*
21 * Profiling data types used for gcc 3.4 and above - these are defined by
22 * gcc and need to be kept as close to the original definition as possible to
23 * remain compatible.
24 */
 
25#define GCOV_DATA_MAGIC		((unsigned int) 0x67636461)
26#define GCOV_TAG_FUNCTION	((unsigned int) 0x01000000)
27#define GCOV_TAG_COUNTER_BASE	((unsigned int) 0x01a10000)
28#define GCOV_TAG_FOR_COUNTER(count)					\
29	(GCOV_TAG_COUNTER_BASE + ((unsigned int) (count) << 17))
30
31#if BITS_PER_LONG >= 64
32typedef long gcov_type;
33#else
34typedef long long gcov_type;
35#endif
36
37/* Opaque gcov_info. The gcov structures can change as for example in gcc 4.7 so
38 * we cannot use full definition here and they need to be placed in gcc specific
39 * implementation of gcov. This also means no direct access to the members in
40 * generic code and usage of the interface below.*/
41struct gcov_info;
42
43/* Interface to access gcov_info data  */
44const char *gcov_info_filename(struct gcov_info *info);
45unsigned int gcov_info_version(struct gcov_info *info);
46struct gcov_info *gcov_info_next(struct gcov_info *info);
47void gcov_info_link(struct gcov_info *info);
48void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
50/* Base interface. */
51enum gcov_action {
52	GCOV_ADD,
53	GCOV_REMOVE,
54};
55
56void gcov_event(enum gcov_action action, struct gcov_info *info);
57void gcov_enable_events(void);
58
59/* Iterator control. */
60struct seq_file;
61struct gcov_iterator;
62
63struct gcov_iterator *gcov_iter_new(struct gcov_info *info);
64void gcov_iter_free(struct gcov_iterator *iter);
65void gcov_iter_start(struct gcov_iterator *iter);
66int gcov_iter_next(struct gcov_iterator *iter);
67int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq);
68struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter);
69
70/* gcov_info control. */
71void gcov_info_reset(struct gcov_info *info);
72int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2);
73void gcov_info_add(struct gcov_info *dest, struct gcov_info *source);
74struct gcov_info *gcov_info_dup(struct gcov_info *info);
75void gcov_info_free(struct gcov_info *info);
76
77struct gcov_link {
78	enum {
79		OBJ_TREE,
80		SRC_TREE,
81	} dir;
82	const char *ext;
83};
84extern const struct gcov_link gcov_link[];
85
86#endif /* GCOV_H */
v3.1
 
  1/*
  2 *  Profiling infrastructure declarations.
  3 *
  4 *  This file is based on gcc-internal definitions. Data structures are
  5 *  defined to be compatible with gcc counterparts. For a better
  6 *  understanding, refer to gcc source: gcc/gcov-io.h.
  7 *
  8 *    Copyright IBM Corp. 2009
  9 *    Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
 10 *
 11 *    Uses gcc-internal data definitions.
 12 */
 13
 14#ifndef GCOV_H
 15#define GCOV_H GCOV_H
 16
 17#include <linux/types.h>
 18
 19/*
 20 * Profiling data types used for gcc 3.4 and above - these are defined by
 21 * gcc and need to be kept as close to the original definition as possible to
 22 * remain compatible.
 23 */
 24#define GCOV_COUNTERS		5
 25#define GCOV_DATA_MAGIC		((unsigned int) 0x67636461)
 26#define GCOV_TAG_FUNCTION	((unsigned int) 0x01000000)
 27#define GCOV_TAG_COUNTER_BASE	((unsigned int) 0x01a10000)
 28#define GCOV_TAG_FOR_COUNTER(count)					\
 29	(GCOV_TAG_COUNTER_BASE + ((unsigned int) (count) << 17))
 30
 31#if BITS_PER_LONG >= 64
 32typedef long gcov_type;
 33#else
 34typedef long long gcov_type;
 35#endif
 36
 37/**
 38 * struct gcov_fn_info - profiling meta data per function
 39 * @ident: object file-unique function identifier
 40 * @checksum: function checksum
 41 * @n_ctrs: number of values per counter type belonging to this function
 42 *
 43 * This data is generated by gcc during compilation and doesn't change
 44 * at run-time.
 45 */
 46struct gcov_fn_info {
 47	unsigned int ident;
 48	unsigned int checksum;
 49	unsigned int n_ctrs[0];
 50};
 51
 52/**
 53 * struct gcov_ctr_info - profiling data per counter type
 54 * @num: number of counter values for this type
 55 * @values: array of counter values for this type
 56 * @merge: merge function for counter values of this type (unused)
 57 *
 58 * This data is generated by gcc during compilation and doesn't change
 59 * at run-time with the exception of the values array.
 60 */
 61struct gcov_ctr_info {
 62	unsigned int	num;
 63	gcov_type	*values;
 64	void		(*merge)(gcov_type *, unsigned int);
 65};
 66
 67/**
 68 * struct gcov_info - profiling data per object file
 69 * @version: gcov version magic indicating the gcc version used for compilation
 70 * @next: list head for a singly-linked list
 71 * @stamp: time stamp
 72 * @filename: name of the associated gcov data file
 73 * @n_functions: number of instrumented functions
 74 * @functions: function data
 75 * @ctr_mask: mask specifying which counter types are active
 76 * @counts: counter data per counter type
 77 *
 78 * This data is generated by gcc during compilation and doesn't change
 79 * at run-time with the exception of the next pointer.
 80 */
 81struct gcov_info {
 82	unsigned int			version;
 83	struct gcov_info		*next;
 84	unsigned int			stamp;
 85	const char			*filename;
 86	unsigned int			n_functions;
 87	const struct gcov_fn_info	*functions;
 88	unsigned int			ctr_mask;
 89	struct gcov_ctr_info		counts[0];
 90};
 91
 92/* Base interface. */
 93enum gcov_action {
 94	GCOV_ADD,
 95	GCOV_REMOVE,
 96};
 97
 98void gcov_event(enum gcov_action action, struct gcov_info *info);
 99void gcov_enable_events(void);
100
101/* Iterator control. */
102struct seq_file;
103struct gcov_iterator;
104
105struct gcov_iterator *gcov_iter_new(struct gcov_info *info);
106void gcov_iter_free(struct gcov_iterator *iter);
107void gcov_iter_start(struct gcov_iterator *iter);
108int gcov_iter_next(struct gcov_iterator *iter);
109int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq);
110struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter);
111
112/* gcov_info control. */
113void gcov_info_reset(struct gcov_info *info);
114int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2);
115void gcov_info_add(struct gcov_info *dest, struct gcov_info *source);
116struct gcov_info *gcov_info_dup(struct gcov_info *info);
117void gcov_info_free(struct gcov_info *info);
118
119struct gcov_link {
120	enum {
121		OBJ_TREE,
122		SRC_TREE,
123	} dir;
124	const char *ext;
125};
126extern const struct gcov_link gcov_link[];
127
128#endif /* GCOV_H */