gmon.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Format of gmon.out file. */
  2. /* This header appears at the beginning of the gmon.out file.
  3. LOW and HIGH are low and high water marks for the program counter
  4. during the creation of the gmon.out file.
  5. LOW is also the offset where the histogram table starts in the
  6. text (code) segment.
  7. NBYTES is the number of bytes in this header plus the histogram itself,
  8. which immediately follows the header in the file.
  9. Therefore, the number of histogram entries is
  10. (NBYTES - sizeof (struct gm_header)) / (sizeof (CHUNK)).
  11. Each entry applies to a range of PC values.
  12. The first entry applies to PC values starting at LOW.
  13. The last entry applies to PC values ending at HIGH.
  14. Therefore, the span of each entry's range is
  15. (HIGH - LOW) / number-of-entries
  16. Usually this value is 4.
  17. */
  18. struct gm_header {
  19. unsigned long low;
  20. unsigned long high;
  21. long nbytes;
  22. };
  23. /* Data type of an entry in the PC histogram. */
  24. #define CHUNK short
  25. /* After the histogram cone the function call count entries.
  26. They fill all the rest of the file.
  27. Each count entry records the number of calls to one function
  28. from one pc value.
  29. FROM describes the caller pc, as an offset into the text segment.
  30. TO is the address of the called function.
  31. NCALLS is the number of calls counted from FROM to TO.
  32. Note that if a function A is called from several places in B,
  33. there are separate call count entries for each call, with different FROM.
  34. All of them together count the number of calls from B to A. */
  35. struct gm_call {
  36. unsigned long from;
  37. unsigned long to;
  38. unsigned long ncalls;
  39. };