timevar.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* Timing variables for measuring compiler performance.
  2. Copyright (C) 2000, 2002, 2004, 2009-2013 Free Software Foundation,
  3. Inc.
  4. Contributed by Alex Samuel <samuel@codesourcery.com>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #ifndef GCC_TIMEVAR_H
  16. #define GCC_TIMEVAR_H
  17. /* Timing variables are used to measure elapsed time in various
  18. portions of the compiler. Each measures elapsed user, system, and
  19. wall-clock time, as appropriate to and supported by the host
  20. system.
  21. Timing variables are defined using the DEFTIMEVAR macro in
  22. timevar.def. Each has an enumeral identifier, used when referring
  23. to the timing variable in code, and a character string name.
  24. Timing variables can be used in two ways:
  25. - On the timing stack, using timevar_push and timevar_pop.
  26. Timing variables may be pushed onto the stack; elapsed time is
  27. attributed to the topmost timing variable on the stack. When
  28. another variable is pushed on, the previous topmost variable is
  29. 'paused' until the pushed variable is popped back off.
  30. - As a standalone timer, using timevar_start and timevar_stop.
  31. All time elapsed between the two calls is attributed to the
  32. variable.
  33. */
  34. /* This structure stores the various varieties of time that can be
  35. measured. Times are stored in seconds. The time may be an
  36. absolute time or a time difference; in the former case, the time
  37. base is undefined, except that the difference between two times
  38. produces a valid time difference. */
  39. struct timevar_time_def
  40. {
  41. /* User time in this process. */
  42. float user;
  43. /* System time (if applicable for this host platform) in this
  44. process. */
  45. float sys;
  46. /* Wall clock time. */
  47. float wall;
  48. };
  49. /* An enumeration of timing variable identifiers. Constructed from
  50. the contents of timevar.def. */
  51. #define DEFTIMEVAR(identifier__, name__) \
  52. identifier__,
  53. typedef enum
  54. {
  55. #include "timevar.def"
  56. TIMEVAR_LAST
  57. }
  58. timevar_id_t;
  59. #undef DEFTIMEVAR
  60. extern void init_timevar (void);
  61. extern void timevar_push (timevar_id_t);
  62. extern void timevar_pop (timevar_id_t);
  63. extern void timevar_start (timevar_id_t);
  64. extern void timevar_stop (timevar_id_t);
  65. extern void timevar_get (timevar_id_t, struct timevar_time_def *);
  66. extern void timevar_print (FILE *);
  67. /* Provided for backward compatibility. */
  68. extern long get_run_time (void);
  69. extern void print_time (const char *, long);
  70. extern int timevar_report;
  71. #endif /* ! GCC_TIMEVAR_H */