SphinxBase 0.6

include/sphinxbase/profile.h

Go to the documentation of this file.
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 #include <stdio.h>
00088 
00089 /* Win32/WinCE DLL gunk */
00090 #include <sphinxbase/sphinxbase_export.h>
00091 #include <sphinxbase/prim_type.h>
00092 
00093 
00100 typedef struct {
00101         char *name;             
00104         int32 count;            
00105 } pctr_t;
00106 
00115 SPHINXBASE_EXPORT
00116 pctr_t* pctr_new (
00117         char *name   
00118         );
00119 
00124 SPHINXBASE_EXPORT
00125 void pctr_reset (pctr_t *ctr  
00126         );
00127 
00131 SPHINXBASE_EXPORT
00132 void pctr_print(FILE *fp,      
00133                 pctr_t *ctr   
00134         );
00135 
00139 SPHINXBASE_EXPORT
00140 void pctr_increment (pctr_t *ctr, 
00141                      int32 inc   
00142         );
00143 
00147 SPHINXBASE_EXPORT
00148 void pctr_free(pctr_t* ctr 
00149         );
00150 
00151 
00157 typedef struct {
00158         const char *name;               
00160         float64 t_cpu;          
00161         float64 t_elapsed;              
00162         float64 t_tot_cpu;              
00163         float64 t_tot_elapsed;  
00164         float64 start_cpu;              
00165         float64 start_elapsed;  
00166 } ptmr_t;
00167 
00168 
00169 
00171 SPHINXBASE_EXPORT
00172 void ptmr_start (ptmr_t *tmr 
00173         );
00174 
00176 SPHINXBASE_EXPORT
00177 void ptmr_stop (ptmr_t *tmr  
00178         );
00179 
00181 SPHINXBASE_EXPORT
00182 void ptmr_reset (ptmr_t *tmr  
00183         );
00184 
00187 SPHINXBASE_EXPORT
00188 void ptmr_init (ptmr_t *tmr 
00189         );
00190 
00191 
00196 SPHINXBASE_EXPORT
00197 void ptmr_reset_all (ptmr_t *tmr 
00198         );
00199 
00204 SPHINXBASE_EXPORT
00205 void ptmr_print_all (FILE *fp,    
00206                      ptmr_t *tmr, 
00207                      float64 norm
00208         );
00209 
00210 
00215 SPHINXBASE_EXPORT
00216 int32 host_pclk (int32 dummy);
00217 
00218 
00219 /*
00220  * Check the native byte-ordering of the machine by writing a magic
00221  * number to a temporary file and reading it back.  * Return value:
00222  * 0 if BIG-ENDIAN, 1 if LITTLE-ENDIAN, -1 if error.  
00223  */
00224 SPHINXBASE_EXPORT
00225 int32 host_endian ( void );
00226 
00227 #ifdef __cplusplus
00228 }
00229 #endif
00230 
00231 #endif