gmon_out.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Copyright (C) 1996-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. /* This file specifies the format of gmon.out files. It should have
  15. as few external dependencies as possible as it is going to be included
  16. in many different programs. That is, minimize the number of #include's.
  17. A gmon.out file consists of a header (defined by gmon_hdr) followed by
  18. a sequence of records. Each record starts with a one-byte tag
  19. identifying the type of records, followed by records specific data. */
  20. #ifndef _SYS_GMON_OUT_H
  21. #define _SYS_GMON_OUT_H 1
  22. #include <features.h>
  23. #define GMON_MAGIC "gmon" /* magic cookie */
  24. #define GMON_VERSION 1 /* version number */
  25. /* For profiling shared object we need a new format. */
  26. #define GMON_SHOBJ_VERSION 0x1ffff
  27. __BEGIN_DECLS
  28. /*
  29. * Raw header as it appears on file (without padding). This header
  30. * always comes first in gmon.out and is then followed by a series
  31. * records defined below.
  32. */
  33. struct gmon_hdr
  34. {
  35. char cookie[4];
  36. char version[4];
  37. char spare[3 * 4];
  38. };
  39. /* types of records in this file: */
  40. typedef enum
  41. {
  42. GMON_TAG_TIME_HIST = 0,
  43. GMON_TAG_CG_ARC = 1,
  44. GMON_TAG_BB_COUNT = 2
  45. } GMON_Record_Tag;
  46. struct gmon_hist_hdr
  47. {
  48. char low_pc[sizeof (char *)]; /* base pc address of sample buffer */
  49. char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */
  50. char hist_size[4]; /* size of sample buffer */
  51. char prof_rate[4]; /* profiling clock rate */
  52. char dimen[15]; /* phys. dim., usually "seconds" */
  53. char dimen_abbrev; /* usually 's' for "seconds" */
  54. };
  55. struct gmon_cg_arc_record
  56. {
  57. char from_pc[sizeof (char *)]; /* address within caller's body */
  58. char self_pc[sizeof (char *)]; /* address within callee's body */
  59. char count[4]; /* number of arc traversals */
  60. };
  61. __END_DECLS
  62. #endif /* sys/gmon_out.h */