timevar.h revision 117395
131567Ssef/* Timing variables for measuring compiler performance. 231899Ssef Copyright (C) 2000 Free Software Foundation, Inc. 331899Ssef Contributed by Alex Samuel <samuel@codesourcery.com> 431899Ssef 531899Ssef This file is part of GCC. 631899Ssef 731899Ssef GCC is free software; you can redistribute it and/or modify it 831899Ssef under the terms of the GNU General Public License as published by 931899Ssef the Free Software Foundation; either version 2, or (at your option) 1031899Ssef any later version. 1131899Ssef 1231899Ssef GCC is distributed in the hope that it will be useful, but WITHOUT 1331899Ssef ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 1431899Ssef or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 1531899Ssef License for more details. 1631899Ssef 1731899Ssef You should have received a copy of the GNU General Public License 1831899Ssef along with GCC; see the file COPYING. If not, write to the Free 1931899Ssef Software Foundation, 59 Temple Place - Suite 330, Boston, MA 2031899Ssef 02111-1307, USA. */ 2131899Ssef 2231899Ssef#ifndef GCC_TIMEVAR_H 2331899Ssef#define GCC_TIMEVAR_H 2431899Ssef 2531899Ssef/* Timing variables are used to measure elapsed time in various 2631899Ssef portions of the compiler. Each measures elapsed user, system, and 2731899Ssef wall-clock time, as appropriate to and supported by the host 2831899Ssef system. 2931899Ssef 3031899Ssef Timing variables are defined using the DEFTIMEVAR macro in 3131899Ssef timevar.def. Each has an enumeral identifier, used when referring 3232275Scharnier to the timing variable in code, and a character string name. 3332275Scharnier 3439908Ssef Timing variables can be used in two ways: 3532275Scharnier 3632275Scharnier - On the timing stack, using timevar_push and timevar_pop. 3731899Ssef Timing variables may be pushed onto the stack; elapsed time is 3831567Ssef attributed to the topmost timing variable on the stack. When 3931567Ssef another variable is pushed on, the previous topmost variable is 4031567Ssef `paused' until the pushed variable is popped back off. 4131567Ssef 4231567Ssef - As a standalone timer, using timevar_start and timevar_stop. 4332275Scharnier All time elapsed between the two calls is attributed to the 4432275Scharnier variable. 4532275Scharnier*/ 4632275Scharnier 4731567Ssef/* This structure stores the various varieties of time that can be 4831567Ssef measured. Times are stored in seconds. The time may be an 4931567Ssef absolute time or a time difference; in the former case, the time 5031579Speter base is undefined, except that the difference between two times 5131567Ssef produces a valid time difference. */ 5231567Ssef 5331567Ssefstruct timevar_time_def 5431567Ssef{ 5531567Ssef /* User time in this process. */ 5639908Ssef float user; 5739908Ssef 5839908Ssef /* System time (if applicable for this host platform) in this 5939908Ssef process. */ 6039908Ssef float sys; 6131567Ssef 6231567Ssef /* Wall clock time. */ 6331567Ssef float wall; 6431567Ssef}; 6539908Ssef 6631567Ssef/* An enumeration of timing variable identifiers. Constructed from 6731567Ssef the contents of timevar.def. */ 6831567Ssef 6931567Ssef#define DEFTIMEVAR(identifier__, name__) \ 7031567Ssef identifier__, 7131567Sseftypedef enum 7231567Ssef{ 7331567Ssef#include "timevar.def" 7431567Ssef TIMEVAR_LAST 7531567Ssef} 7631567Sseftimevar_id_t; 7731567Ssef#undef DEFTIMEVAR 7831567Ssef 7932275Scharnier/* Execute the sequence: timevar_pop (TV), return (E); */ 8032275Scharnier#define POP_TIMEVAR_AND_RETURN(TV, E) return (timevar_pop (TV), (E)) 8132275Scharnier 8232275Scharnierextern void init_timevar PARAMS ((void)); 8332275Scharnierextern void timevar_push PARAMS ((timevar_id_t)); 8431567Ssefextern void timevar_pop PARAMS ((timevar_id_t)); 8531567Ssefextern void timevar_start PARAMS ((timevar_id_t)); 8631567Ssefextern void timevar_stop PARAMS ((timevar_id_t)); 8738897Ssefextern void timevar_get PARAMS ((timevar_id_t, struct timevar_time_def *)); 8838897Ssefextern void timevar_print PARAMS ((FILE *)); 8938897Ssef 9038897Ssef/* Provided for backward compatibility. */ 9131567Ssefextern long get_run_time PARAMS ((void)); 9231567Ssefextern void print_time PARAMS ((const char *, long)); 9331567Ssef 9431567Ssef#endif /* ! GCC_TIMEVAR_H */ 9531567Ssef