00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 00002 /* ==================================================================== 00003 * Copyright (c) 1999-2001 Carnegie Mellon University. All rights 00004 * reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in 00015 * the documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * This work was supported in part by funding from the Defense Advanced 00019 * Research Projects Agency and the National Science Foundation of the 00020 * United States of America, and the CMU Sphinx Speech Consortium. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 00023 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00024 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00025 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 00026 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 * ==================================================================== 00035 * 00036 */ 00037 /* 00038 * profile.h -- For timing and event counting. 00039 * 00040 * ********************************************** 00041 * CMU ARPA Speech Project 00042 * 00043 * Copyright (c) 1999 Carnegie Mellon University. 00044 * ALL RIGHTS RESERVED. 00045 * ********************************************** 00046 * 00047 * HISTORY 00048 * $Log: profile.h,v $ 00049 * Revision 1.10 2005/06/22 03:10:59 arthchan2003 00050 * 1, Fixed doxygen documentation, 2, Added keyword. 00051 * 00052 * Revision 1.5 2005/06/15 04:21:47 archan 00053 * 1, Fixed doxygen-documentation, 2, Add keyword such that changes will be logged into a file. 00054 * 00055 * Revision 1.4 2005/04/25 19:22:48 archan 00056 * Refactor out the code of rescoring from lexical tree. Potentially we want to turn off the rescoring if we need. 00057 * 00058 * Revision 1.3 2005/03/30 01:22:48 archan 00059 * Fixed mistakes in last updates. Add 00060 * 00061 * 00062 * 11-Mar-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00063 * Added ptmr_init(). 00064 * 00065 * 19-Jun-97 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University 00066 * Created from earlier Sphinx-3 version. 00067 */ 00068 00069 00070 #ifndef _LIBUTIL_PROFILE_H_ 00071 #define _LIBUTIL_PROFILE_H_ 00072 00073 #ifdef __cplusplus 00074 extern "C" { 00075 #endif 00076 #if 0 00077 } /* Fool Emacs into not indenting things. */ 00078 #endif 00079 00087 /* Win32/WinCE DLL gunk */ 00088 #include <sphinxbase_export.h> 00089 #include <prim_type.h> 00090 00091 00098 typedef struct { 00099 char *name; 00102 int32 count; 00103 } pctr_t; 00104 00113 SPHINXBASE_EXPORT 00114 pctr_t* pctr_new ( 00115 char *name 00116 ); 00117 00122 SPHINXBASE_EXPORT 00123 void pctr_reset (pctr_t *ctr 00124 ); 00125 00129 SPHINXBASE_EXPORT 00130 void pctr_print(FILE *fp, 00131 pctr_t *ctr 00132 ); 00133 00137 SPHINXBASE_EXPORT 00138 void pctr_increment (pctr_t *ctr, 00139 int32 inc 00140 ); 00141 00145 SPHINXBASE_EXPORT 00146 void pctr_free(pctr_t* ctr 00147 ); 00148 00149 00155 typedef struct { 00156 const char *name; 00158 float64 t_cpu; 00159 float64 t_elapsed; 00160 float64 t_tot_cpu; 00161 float64 t_tot_elapsed; 00162 float64 start_cpu; 00163 float64 start_elapsed; 00164 } ptmr_t; 00165 00166 00167 00169 SPHINXBASE_EXPORT 00170 void ptmr_start (ptmr_t *tmr 00171 ); 00172 00174 SPHINXBASE_EXPORT 00175 void ptmr_stop (ptmr_t *tmr 00176 ); 00177 00179 SPHINXBASE_EXPORT 00180 void ptmr_reset (ptmr_t *tmr 00181 ); 00182 00185 SPHINXBASE_EXPORT 00186 void ptmr_init (ptmr_t *tmr 00187 ); 00188 00189 00194 SPHINXBASE_EXPORT 00195 void ptmr_reset_all (ptmr_t *tmr 00196 ); 00197 00202 SPHINXBASE_EXPORT 00203 void ptmr_print_all (FILE *fp, 00204 ptmr_t *tmr, 00205 float64 norm 00206 ); 00207 00208 00213 SPHINXBASE_EXPORT 00214 int32 host_pclk (int32 dummy); 00215 00216 00217 /* 00218 * Check the native byte-ordering of the machine by writing a magic 00219 * number to a temporary file and reading it back. * Return value: 00220 * 0 if BIG-ENDIAN, 1 if LITTLE-ENDIAN, -1 if error. 00221 */ 00222 SPHINXBASE_EXPORT 00223 int32 host_endian ( void ); 00224 00225 #ifdef __cplusplus 00226 } 00227 #endif 00228 00229 #endif