OSDN Git Service

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