12521f2c2SPeter Oberparleiter /* 22521f2c2SPeter Oberparleiter * Profiling infrastructure declarations. 32521f2c2SPeter Oberparleiter * 42521f2c2SPeter Oberparleiter * This file is based on gcc-internal definitions. Data structures are 52521f2c2SPeter Oberparleiter * defined to be compatible with gcc counterparts. For a better 62521f2c2SPeter Oberparleiter * understanding, refer to gcc source: gcc/gcov-io.h. 72521f2c2SPeter Oberparleiter * 82521f2c2SPeter Oberparleiter * Copyright IBM Corp. 2009 92521f2c2SPeter Oberparleiter * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com> 102521f2c2SPeter Oberparleiter * 112521f2c2SPeter Oberparleiter * Uses gcc-internal data definitions. 122521f2c2SPeter Oberparleiter */ 132521f2c2SPeter Oberparleiter 142521f2c2SPeter Oberparleiter #ifndef GCOV_H 152521f2c2SPeter Oberparleiter #define GCOV_H GCOV_H 162521f2c2SPeter Oberparleiter 172521f2c2SPeter Oberparleiter #include <linux/types.h> 182521f2c2SPeter Oberparleiter 192521f2c2SPeter Oberparleiter /* 202521f2c2SPeter Oberparleiter * Profiling data types used for gcc 3.4 and above - these are defined by 212521f2c2SPeter Oberparleiter * gcc and need to be kept as close to the original definition as possible to 222521f2c2SPeter Oberparleiter * remain compatible. 232521f2c2SPeter Oberparleiter */ 242521f2c2SPeter Oberparleiter #define GCOV_DATA_MAGIC ((unsigned int) 0x67636461) 252521f2c2SPeter Oberparleiter #define GCOV_TAG_FUNCTION ((unsigned int) 0x01000000) 262521f2c2SPeter Oberparleiter #define GCOV_TAG_COUNTER_BASE ((unsigned int) 0x01a10000) 272521f2c2SPeter Oberparleiter #define GCOV_TAG_FOR_COUNTER(count) \ 282521f2c2SPeter Oberparleiter (GCOV_TAG_COUNTER_BASE + ((unsigned int) (count) << 17)) 292521f2c2SPeter Oberparleiter 302521f2c2SPeter Oberparleiter #if BITS_PER_LONG >= 64 312521f2c2SPeter Oberparleiter typedef long gcov_type; 322521f2c2SPeter Oberparleiter #else 332521f2c2SPeter Oberparleiter typedef long long gcov_type; 342521f2c2SPeter Oberparleiter #endif 352521f2c2SPeter Oberparleiter 36*8cbce376SFrantisek Hrbata /* Opaque gcov_info. The gcov structures can change as for example in gcc 4.7 so 37*8cbce376SFrantisek Hrbata * we cannot use full definition here and they need to be placed in gcc specific 38*8cbce376SFrantisek Hrbata * implementation of gcov. This also means no direct access to the members in 39*8cbce376SFrantisek Hrbata * generic code and usage of the interface below.*/ 40*8cbce376SFrantisek Hrbata struct gcov_info; 412521f2c2SPeter Oberparleiter 42*8cbce376SFrantisek Hrbata /* Interface to access gcov_info data */ 43*8cbce376SFrantisek Hrbata const char *gcov_info_filename(struct gcov_info *info); 44*8cbce376SFrantisek Hrbata unsigned int gcov_info_version(struct gcov_info *info); 45*8cbce376SFrantisek Hrbata struct gcov_info *gcov_info_next(struct gcov_info *info); 46*8cbce376SFrantisek Hrbata void gcov_info_link(struct gcov_info *info); 47*8cbce376SFrantisek Hrbata void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info); 482521f2c2SPeter Oberparleiter 492521f2c2SPeter Oberparleiter /* Base interface. */ 502521f2c2SPeter Oberparleiter enum gcov_action { 512521f2c2SPeter Oberparleiter GCOV_ADD, 522521f2c2SPeter Oberparleiter GCOV_REMOVE, 532521f2c2SPeter Oberparleiter }; 542521f2c2SPeter Oberparleiter 552521f2c2SPeter Oberparleiter void gcov_event(enum gcov_action action, struct gcov_info *info); 562521f2c2SPeter Oberparleiter void gcov_enable_events(void); 572521f2c2SPeter Oberparleiter 582521f2c2SPeter Oberparleiter /* Iterator control. */ 592521f2c2SPeter Oberparleiter struct seq_file; 602521f2c2SPeter Oberparleiter struct gcov_iterator; 612521f2c2SPeter Oberparleiter 622521f2c2SPeter Oberparleiter struct gcov_iterator *gcov_iter_new(struct gcov_info *info); 632521f2c2SPeter Oberparleiter void gcov_iter_free(struct gcov_iterator *iter); 642521f2c2SPeter Oberparleiter void gcov_iter_start(struct gcov_iterator *iter); 652521f2c2SPeter Oberparleiter int gcov_iter_next(struct gcov_iterator *iter); 662521f2c2SPeter Oberparleiter int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq); 672521f2c2SPeter Oberparleiter struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter); 682521f2c2SPeter Oberparleiter 692521f2c2SPeter Oberparleiter /* gcov_info control. */ 702521f2c2SPeter Oberparleiter void gcov_info_reset(struct gcov_info *info); 712521f2c2SPeter Oberparleiter int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2); 722521f2c2SPeter Oberparleiter void gcov_info_add(struct gcov_info *dest, struct gcov_info *source); 732521f2c2SPeter Oberparleiter struct gcov_info *gcov_info_dup(struct gcov_info *info); 742521f2c2SPeter Oberparleiter void gcov_info_free(struct gcov_info *info); 752521f2c2SPeter Oberparleiter 762521f2c2SPeter Oberparleiter struct gcov_link { 772521f2c2SPeter Oberparleiter enum { 782521f2c2SPeter Oberparleiter OBJ_TREE, 792521f2c2SPeter Oberparleiter SRC_TREE, 802521f2c2SPeter Oberparleiter } dir; 812521f2c2SPeter Oberparleiter const char *ext; 822521f2c2SPeter Oberparleiter }; 832521f2c2SPeter Oberparleiter extern const struct gcov_link gcov_link[]; 842521f2c2SPeter Oberparleiter 852521f2c2SPeter Oberparleiter #endif /* GCOV_H */ 86