gmon_out.h 3.1 KB

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