gcov.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #ifndef GCOV_H
  14. #define GCOV_H GCOV_H
  15. #include <linux/types.h>
  16. /*
  17. * Profiling data types used for gcc 3.4 and above - these are defined by
  18. * gcc and need to be kept as close to the original definition as possible to
  19. * remain compatible.
  20. */
  21. #define GCOV_DATA_MAGIC ((unsigned int) 0x67636461)
  22. #define GCOV_TAG_FUNCTION ((unsigned int) 0x01000000)
  23. #define GCOV_TAG_COUNTER_BASE ((unsigned int) 0x01a10000)
  24. #define GCOV_TAG_FOR_COUNTER(count) \
  25. (GCOV_TAG_COUNTER_BASE + ((unsigned int) (count) << 17))
  26. #if BITS_PER_LONG >= 64
  27. typedef long gcov_type;
  28. #else
  29. typedef long long gcov_type;
  30. #endif
  31. /* Opaque gcov_info. The gcov structures can change as for example in gcc 4.7 so
  32. * we cannot use full definition here and they need to be placed in gcc specific
  33. * implementation of gcov. This also means no direct access to the members in
  34. * generic code and usage of the interface below.*/
  35. struct gcov_info;
  36. /* Interface to access gcov_info data */
  37. const char *gcov_info_filename(struct gcov_info *info);
  38. unsigned int gcov_info_version(struct gcov_info *info);
  39. struct gcov_info *gcov_info_next(struct gcov_info *info);
  40. void gcov_info_link(struct gcov_info *info);
  41. void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info);
  42. /* Base interface. */
  43. enum gcov_action {
  44. GCOV_ADD,
  45. GCOV_REMOVE,
  46. };
  47. void gcov_event(enum gcov_action action, struct gcov_info *info);
  48. void gcov_enable_events(void);
  49. /* Iterator control. */
  50. struct seq_file;
  51. struct gcov_iterator;
  52. struct gcov_iterator *gcov_iter_new(struct gcov_info *info);
  53. void gcov_iter_free(struct gcov_iterator *iter);
  54. void gcov_iter_start(struct gcov_iterator *iter);
  55. int gcov_iter_next(struct gcov_iterator *iter);
  56. int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq);
  57. struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter);
  58. /* gcov_info control. */
  59. void gcov_info_reset(struct gcov_info *info);
  60. int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2);
  61. void gcov_info_add(struct gcov_info *dest, struct gcov_info *source);
  62. struct gcov_info *gcov_info_dup(struct gcov_info *info);
  63. void gcov_info_free(struct gcov_info *info);
  64. struct gcov_link {
  65. enum {
  66. OBJ_TREE,
  67. SRC_TREE,
  68. } dir;
  69. const char *ext;
  70. };
  71. extern const struct gcov_link gcov_link[];
  72. #endif /* GCOV_H */