SphinxBase  0.6
profile.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 1999-2001 Carnegie Mellon University. All rights
4  * reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * This work was supported in part by funding from the Defense Advanced
19  * Research Projects Agency and the National Science Foundation of the
20  * United States of America, and the CMU Sphinx Speech Consortium.
21  *
22  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * ====================================================================
35  *
36  */
37 /*
38  * profile.h -- For timing and event counting.
39  *
40  * **********************************************
41  * CMU ARPA Speech Project
42  *
43  * Copyright (c) 1999 Carnegie Mellon University.
44  * ALL RIGHTS RESERVED.
45  * **********************************************
46  *
47  * HISTORY
48  * $Log: profile.h,v $
49  * Revision 1.10 2005/06/22 03:10:59 arthchan2003
50  * 1, Fixed doxygen documentation, 2, Added keyword.
51  *
52  * Revision 1.5 2005/06/15 04:21:47 archan
53  * 1, Fixed doxygen-documentation, 2, Add keyword such that changes will be logged into a file.
54  *
55  * Revision 1.4 2005/04/25 19:22:48 archan
56  * Refactor out the code of rescoring from lexical tree. Potentially we want to turn off the rescoring if we need.
57  *
58  * Revision 1.3 2005/03/30 01:22:48 archan
59  * Fixed mistakes in last updates. Add
60  *
61  *
62  * 11-Mar-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
63  * Added ptmr_init().
64  *
65  * 19-Jun-97 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
66  * Created from earlier Sphinx-3 version.
67  */
68 
69 
70 #ifndef _LIBUTIL_PROFILE_H_
71 #define _LIBUTIL_PROFILE_H_
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 #if 0
77 } /* Fool Emacs into not indenting things. */
78 #endif
79 
87 #include <stdio.h>
88 
89 /* Win32/WinCE DLL gunk */
90 #include <sphinxbase/sphinxbase_export.h>
91 #include <sphinxbase/prim_type.h>
92 
93 
100 typedef struct {
101  char *name;
104  int32 count;
105 } pctr_t;
106 
115 SPHINXBASE_EXPORT
116 pctr_t* pctr_new (
117  char *name
118  );
119 
124 SPHINXBASE_EXPORT
125 void pctr_reset (pctr_t *ctr
126  );
127 
131 SPHINXBASE_EXPORT
132 void pctr_print(FILE *fp,
133  pctr_t *ctr
134  );
135 
139 SPHINXBASE_EXPORT
140 void pctr_increment (pctr_t *ctr,
141  int32 inc
142  );
143 
147 SPHINXBASE_EXPORT
148 void pctr_free(pctr_t* ctr
149  );
150 
151 
157 typedef struct {
158  const char *name;
160  float64 t_cpu;
161  float64 t_elapsed;
162  float64 t_tot_cpu;
163  float64 t_tot_elapsed;
164  float64 start_cpu;
165  float64 start_elapsed;
166 } ptmr_t;
167 
168 
169 
171 SPHINXBASE_EXPORT
172 void ptmr_start (ptmr_t *tmr
173  );
174 
176 SPHINXBASE_EXPORT
177 void ptmr_stop (ptmr_t *tmr
178  );
179 
181 SPHINXBASE_EXPORT
182 void ptmr_reset (ptmr_t *tmr
183  );
184 
187 SPHINXBASE_EXPORT
188 void ptmr_init (ptmr_t *tmr
189  );
190 
191 
196 SPHINXBASE_EXPORT
197 void ptmr_reset_all (ptmr_t *tmr
198  );
199 
204 SPHINXBASE_EXPORT
205 void ptmr_print_all (FILE *fp,
206  ptmr_t *tmr,
207  float64 norm
208  );
209 
210 
215 SPHINXBASE_EXPORT
216 int32 host_pclk (int32 dummy);
217 
218 
219 /*
220  * Check the native byte-ordering of the machine by writing a magic
221  * number to a temporary file and reading it back. * Return value:
222  * 0 if BIG-ENDIAN, 1 if LITTLE-ENDIAN, -1 if error.
223  */
224 SPHINXBASE_EXPORT
225 int32 host_endian ( void );
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif