cannam@140
|
1 #ifndef PA_CPULOAD_H
|
cannam@140
|
2 #define PA_CPULOAD_H
|
cannam@140
|
3 /*
|
cannam@140
|
4 * $Id$
|
cannam@140
|
5 * Portable Audio I/O Library CPU Load measurement functions
|
cannam@140
|
6 * Portable CPU load measurement facility.
|
cannam@140
|
7 *
|
cannam@140
|
8 * Based on the Open Source API proposed by Ross Bencina
|
cannam@140
|
9 * Copyright (c) 2002 Ross Bencina
|
cannam@140
|
10 *
|
cannam@140
|
11 * Permission is hereby granted, free of charge, to any person obtaining
|
cannam@140
|
12 * a copy of this software and associated documentation files
|
cannam@140
|
13 * (the "Software"), to deal in the Software without restriction,
|
cannam@140
|
14 * including without limitation the rights to use, copy, modify, merge,
|
cannam@140
|
15 * publish, distribute, sublicense, and/or sell copies of the Software,
|
cannam@140
|
16 * and to permit persons to whom the Software is furnished to do so,
|
cannam@140
|
17 * subject to the following conditions:
|
cannam@140
|
18 *
|
cannam@140
|
19 * The above copyright notice and this permission notice shall be
|
cannam@140
|
20 * included in all copies or substantial portions of the Software.
|
cannam@140
|
21 *
|
cannam@140
|
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
cannam@140
|
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
cannam@140
|
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
cannam@140
|
25 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
cannam@140
|
26 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
cannam@140
|
27 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
cannam@140
|
28 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
cannam@140
|
29 */
|
cannam@140
|
30
|
cannam@140
|
31 /*
|
cannam@140
|
32 * The text above constitutes the entire PortAudio license; however,
|
cannam@140
|
33 * the PortAudio community also makes the following non-binding requests:
|
cannam@140
|
34 *
|
cannam@140
|
35 * Any person wishing to distribute modifications to the Software is
|
cannam@140
|
36 * requested to send the modifications to the original developer so that
|
cannam@140
|
37 * they can be incorporated into the canonical version. It is also
|
cannam@140
|
38 * requested that these non-binding requests be included along with the
|
cannam@140
|
39 * license above.
|
cannam@140
|
40 */
|
cannam@140
|
41
|
cannam@140
|
42 /** @file
|
cannam@140
|
43 @ingroup common_src
|
cannam@140
|
44
|
cannam@140
|
45 @brief Functions to assist in measuring the CPU utilization of a callback
|
cannam@140
|
46 stream. Used to implement the Pa_GetStreamCpuLoad() function.
|
cannam@140
|
47 */
|
cannam@140
|
48
|
cannam@140
|
49
|
cannam@140
|
50 #ifdef __cplusplus
|
cannam@140
|
51 extern "C"
|
cannam@140
|
52 {
|
cannam@140
|
53 #endif /* __cplusplus */
|
cannam@140
|
54
|
cannam@140
|
55
|
cannam@140
|
56 typedef struct {
|
cannam@140
|
57 double samplingPeriod;
|
cannam@140
|
58 double measurementStartTime;
|
cannam@140
|
59 double averageLoad;
|
cannam@140
|
60 } PaUtilCpuLoadMeasurer; /**< @todo need better name than measurer */
|
cannam@140
|
61
|
cannam@140
|
62 void PaUtil_InitializeCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer, double sampleRate );
|
cannam@140
|
63 void PaUtil_BeginCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer );
|
cannam@140
|
64 void PaUtil_EndCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer, unsigned long framesProcessed );
|
cannam@140
|
65 void PaUtil_ResetCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer );
|
cannam@140
|
66 double PaUtil_GetCpuLoad( PaUtilCpuLoadMeasurer* measurer );
|
cannam@140
|
67
|
cannam@140
|
68
|
cannam@140
|
69 #ifdef __cplusplus
|
cannam@140
|
70 }
|
cannam@140
|
71 #endif /* __cplusplus */
|
cannam@140
|
72 #endif /* PA_CPULOAD_H */
|