statistics.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Memory and optimization statistics helpers.
  2. Copyright (C) 2004-2019 Free Software Foundation, Inc.
  3. Contributed by Cygnus Solutions.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  12. License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_STATISTICS
  17. #define GCC_STATISTICS
  18. #if ! defined GATHER_STATISTICS
  19. #error GATHER_STATISTICS must be defined
  20. #endif
  21. #define GCC_MEM_STAT_ARGUMENTS const char * ARG_UNUSED (_loc_name), int ARG_UNUSED (_loc_line), const char * ARG_UNUSED (_loc_function)
  22. #if GATHER_STATISTICS
  23. #define ALONE_MEM_STAT_DECL GCC_MEM_STAT_ARGUMENTS
  24. #define ALONE_FINAL_MEM_STAT_DECL ALONE_MEM_STAT_DECL
  25. #define ALONE_PASS_MEM_STAT _loc_name, _loc_line, _loc_function
  26. #define ALONE_FINAL_PASS_MEM_STAT ALONE_PASS_MEM_STAT
  27. #define ALONE_MEM_STAT_INFO __FILE__, __LINE__, __FUNCTION__
  28. #define MEM_STAT_DECL , ALONE_MEM_STAT_DECL
  29. #define FINAL_MEM_STAT_DECL , ALONE_FINAL_MEM_STAT_DECL
  30. #define PASS_MEM_STAT , ALONE_PASS_MEM_STAT
  31. #define FINAL_PASS_MEM_STAT , ALONE_FINAL_PASS_MEM_STAT
  32. #define MEM_STAT_INFO , ALONE_MEM_STAT_INFO
  33. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
  34. #define ALONE_CXX_MEM_STAT_INFO const char * _loc_name = __builtin_FILE (), int _loc_line = __builtin_LINE (), const char * _loc_function = __builtin_FUNCTION ()
  35. #else
  36. #define ALONE_CXX_MEM_STAT_INFO const char * _loc_name = __FILE__, int _loc_line = __LINE__, const char * _loc_function = NULL
  37. #endif
  38. #define CXX_MEM_STAT_INFO , ALONE_CXX_MEM_STAT_INFO
  39. #else
  40. #define ALONE_MEM_STAT_DECL void
  41. #define ALONE_FINAL_MEM_STAT_DECL GCC_MEM_STAT_ARGUMENTS
  42. #define ALONE_PASS_MEM_STAT
  43. #define ALONE_FINAL_PASS_MEM_STAT 0,0,0
  44. #define ALONE_MEM_STAT_INFO
  45. #define MEM_STAT_DECL
  46. #define FINAL_MEM_STAT_DECL , ALONE_FINAL_MEM_STAT_DECL
  47. #define PASS_MEM_STAT
  48. #define FINAL_PASS_MEM_STAT , ALONE_FINAL_PASS_MEM_STAT
  49. #define MEM_STAT_INFO ALONE_MEM_STAT_INFO
  50. #define ALONE_CXX_MEM_STAT_INFO
  51. #define CXX_MEM_STAT_INFO
  52. #endif
  53. struct function;
  54. /* In statistics.c */
  55. extern void statistics_early_init (void);
  56. extern void statistics_init (void);
  57. extern void statistics_fini (void);
  58. extern void statistics_fini_pass (void);
  59. extern void statistics_counter_event (struct function *, const char *, int);
  60. extern void statistics_histogram_event (struct function *, const char *, int);
  61. #endif