Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gcov.h
Go to the documentation of this file.
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 <[email protected]>
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
32 typedef long gcov_type;
33 #else
34 typedef long long gcov_type;
35 #endif
36 
46 struct gcov_fn_info {
47  unsigned int ident;
48  unsigned int checksum;
49  unsigned int n_ctrs[0];
50 };
51 
61 struct gcov_ctr_info {
62  unsigned int num;
64  void (*merge)(gcov_type *, unsigned int);
65 };
66 
81 struct 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. */
96 };
97 
98 void gcov_event(enum gcov_action action, struct gcov_info *info);
99 void gcov_enable_events(void);
100 
101 /* Iterator control. */
102 struct seq_file;
103 struct gcov_iterator;
104 
105 struct gcov_iterator *gcov_iter_new(struct gcov_info *info);
106 void gcov_iter_free(struct gcov_iterator *iter);
107 void gcov_iter_start(struct gcov_iterator *iter);
108 int gcov_iter_next(struct gcov_iterator *iter);
109 int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq);
110 struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter);
111 
112 /* gcov_info control. */
113 void gcov_info_reset(struct gcov_info *info);
115 void gcov_info_add(struct gcov_info *dest, struct gcov_info *source);
116 struct gcov_info *gcov_info_dup(struct gcov_info *info);
117 void gcov_info_free(struct gcov_info *info);
118 
119 struct gcov_link {
120  enum {
123  } dir;
124  const char *ext;
125 };
126 extern const struct gcov_link gcov_link[];
127 
128 #endif /* GCOV_H */