/*1* Profiling infrastructure declarations.2*3* This file is based on gcc-internal definitions. Data structures are4* defined to be compatible with gcc counterparts. For a better5* understanding, refer to gcc source: gcc/gcov-io.h.6*7* Copyright IBM Corp. 20098* Author(s): Peter Oberparleiter <[email protected]>9*10* Uses gcc-internal data definitions.11*/1213#ifndef GCOV_H14#define GCOV_H GCOV_H1516#include <linux/types.h>1718/*19* Profiling data types used for gcc 3.4 and above - these are defined by20* gcc and need to be kept as close to the original definition as possible to21* remain compatible.22*/23#define GCOV_COUNTERS 524#define GCOV_DATA_MAGIC ((unsigned int) 0x67636461)25#define GCOV_TAG_FUNCTION ((unsigned int) 0x01000000)26#define GCOV_TAG_COUNTER_BASE ((unsigned int) 0x01a10000)27#define GCOV_TAG_FOR_COUNTER(count) \28(GCOV_TAG_COUNTER_BASE + ((unsigned int) (count) << 17))2930#if BITS_PER_LONG >= 6431typedef long gcov_type;32#else33typedef long long gcov_type;34#endif3536/**37* struct gcov_fn_info - profiling meta data per function38* @ident: object file-unique function identifier39* @checksum: function checksum40* @n_ctrs: number of values per counter type belonging to this function41*42* This data is generated by gcc during compilation and doesn't change43* at run-time.44*/45struct gcov_fn_info {46unsigned int ident;47unsigned int checksum;48unsigned int n_ctrs[0];49};5051/**52* struct gcov_ctr_info - profiling data per counter type53* @num: number of counter values for this type54* @values: array of counter values for this type55* @merge: merge function for counter values of this type (unused)56*57* This data is generated by gcc during compilation and doesn't change58* at run-time with the exception of the values array.59*/60struct gcov_ctr_info {61unsigned int num;62gcov_type *values;63void (*merge)(gcov_type *, unsigned int);64};6566/**67* struct gcov_info - profiling data per object file68* @version: gcov version magic indicating the gcc version used for compilation69* @next: list head for a singly-linked list70* @stamp: time stamp71* @filename: name of the associated gcov data file72* @n_functions: number of instrumented functions73* @functions: function data74* @ctr_mask: mask specifying which counter types are active75* @counts: counter data per counter type76*77* This data is generated by gcc during compilation and doesn't change78* at run-time with the exception of the next pointer.79*/80struct gcov_info {81unsigned int version;82struct gcov_info *next;83unsigned int stamp;84const char *filename;85unsigned int n_functions;86const struct gcov_fn_info *functions;87unsigned int ctr_mask;88struct gcov_ctr_info counts[0];89};9091/* Base interface. */92enum gcov_action {93GCOV_ADD,94GCOV_REMOVE,95};9697void gcov_event(enum gcov_action action, struct gcov_info *info);98void gcov_enable_events(void);99100/* Iterator control. */101struct seq_file;102struct gcov_iterator;103104struct gcov_iterator *gcov_iter_new(struct gcov_info *info);105void gcov_iter_free(struct gcov_iterator *iter);106void gcov_iter_start(struct gcov_iterator *iter);107int gcov_iter_next(struct gcov_iterator *iter);108int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq);109struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter);110111/* gcov_info control. */112void gcov_info_reset(struct gcov_info *info);113int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2);114void gcov_info_add(struct gcov_info *dest, struct gcov_info *source);115struct gcov_info *gcov_info_dup(struct gcov_info *info);116void gcov_info_free(struct gcov_info *info);117118struct gcov_link {119enum {120OBJ_TREE,121SRC_TREE,122} dir;123const char *ext;124};125extern const struct gcov_link gcov_link[];126127#endif /* GCOV_H */128129130