timevar.h revision 90075
190075Sobrien/* Timing variables for measuring compiler performance.
290075Sobrien   Copyright (C) 2000 Free Software Foundation, Inc.
390075Sobrien   Contributed by Alex Samuel <samuel@codesourcery.com>
490075Sobrien
590075Sobrien   This file is part of GCC.
690075Sobrien
790075Sobrien   GCC is free software; you can redistribute it and/or modify it
890075Sobrien   under the terms of the GNU General Public License as published by
990075Sobrien   the Free Software Foundation; either version 2, or (at your option)
1090075Sobrien   any later version.
1190075Sobrien
1290075Sobrien   GCC is distributed in the hope that it will be useful, but WITHOUT
1390075Sobrien   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1490075Sobrien   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
1590075Sobrien   License for more details.
1690075Sobrien
1790075Sobrien   You should have received a copy of the GNU General Public License
1890075Sobrien   along with GCC; see the file COPYING.  If not, write to the Free
1990075Sobrien   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2090075Sobrien   02111-1307, USA.  */
2190075Sobrien
2290075Sobrien#ifndef GCC_TIMEVAR_H
2390075Sobrien#define GCC_TIMEVAR_H
2490075Sobrien
2590075Sobrien/* Timing variables are used to measure elapsed time in various
2690075Sobrien   portions of the compiler.  Each measures elapsed user, system, and
2790075Sobrien   wall-clock time, as appropriate to and supported by the host
2890075Sobrien   system.
2990075Sobrien
3090075Sobrien   Timing variables are defined using the DEFTIMEVAR macro in
3190075Sobrien   timevar.def.  Each has an enumeral identifier, used when referring
3290075Sobrien   to the timing variable in code, and a character string name.
3390075Sobrien
3490075Sobrien   Timing variables can be used in two ways:
3590075Sobrien
3690075Sobrien     - On the timing stack, using timevar_push and timevar_pop.
3790075Sobrien       Timing variables may be pushed onto the stack; elapsed time is
3890075Sobrien       attributed to the topmost timing variable on the stack.  When
3990075Sobrien       another variable is pushed on, the previous topmost variable is
4090075Sobrien       `paused' until the pushed variable is popped back off.
4190075Sobrien
4290075Sobrien     - As a standalone timer, using timevar_start and timevar_stop.
4390075Sobrien       All time elapsed between the two calls is attributed to the
4490075Sobrien       variable.
4590075Sobrien*/
4690075Sobrien
4790075Sobrien/* This structure stores the various varieties of time that can be
4890075Sobrien   measured.  Times are stored in seconds.  The time may be an
4990075Sobrien   absolute time or a time difference; in the former case, the time
5090075Sobrien   base is undefined, except that the difference between two times
5190075Sobrien   produces a valid time difference.  */
5290075Sobrien
5390075Sobrienstruct timevar_time_def
5490075Sobrien{
5590075Sobrien  /* User time in this process.  */
5690075Sobrien  float user;
5790075Sobrien
5890075Sobrien  /* System time (if applicable for this host platform) in this
5990075Sobrien     process.  */
6090075Sobrien  float sys;
6190075Sobrien
6290075Sobrien  /* Wall clock time.  */
6390075Sobrien  float wall;
6490075Sobrien};
6590075Sobrien
6690075Sobrien/* An enumeration of timing variable identifiers.  Constructed from
6790075Sobrien   the contents of timevar.def.  */
6890075Sobrien
6990075Sobrien#define DEFTIMEVAR(identifier__, name__) \
7090075Sobrien    identifier__,
7190075Sobrientypedef enum
7290075Sobrien{
7390075Sobrien#include "timevar.def"
7490075Sobrien  TIMEVAR_LAST
7590075Sobrien}
7690075Sobrientimevar_id_t;
7790075Sobrien#undef DEFTIMEVAR
7890075Sobrien
7990075Sobrienextern void init_timevar PARAMS ((void));
8090075Sobrienextern void timevar_push PARAMS ((timevar_id_t));
8190075Sobrienextern void timevar_pop PARAMS ((timevar_id_t));
8290075Sobrienextern void timevar_start PARAMS ((timevar_id_t));
8390075Sobrienextern void timevar_stop PARAMS ((timevar_id_t));
8490075Sobrienextern void timevar_get PARAMS ((timevar_id_t, struct timevar_time_def *));
8590075Sobrienextern void timevar_print PARAMS ((FILE *));
8690075Sobrien
8790075Sobrien/* Provided for backward compatibility.  */
8890075Sobrienextern long get_run_time PARAMS ((void));
8990075Sobrienextern void print_time PARAMS ((const char *, long));
9090075Sobrien
9190075Sobrien#endif /* ! GCC_TIMEVAR_H */
92