Jack2 1.9.12

JackEngineProfiling.h
1 /*
2 Copyright (C) 2008 Grame & RTL
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 */
19
20 #ifndef __JackEngineProfiling__
21 #define __JackEngineProfiling__
22
23 #include "types.h"
24 #include "JackTypes.h"
25 #include "JackConstants.h"
26 #include "JackShmMem.h"
27
28 namespace Jack
29 {
30
31 #define TIME_POINTS 100000
32 #define FAILURE_TIME_POINTS 10000
33 #define FAILURE_WINDOW 10
34 #define MEASURED_CLIENTS 32
35
40 PRE_PACKED_STRUCTURE
41 struct JackTimingMeasureClient
42 {
43 int fRefNum;
44 jack_time_t fSignaledAt;
45 jack_time_t fAwakeAt;
46 jack_time_t fFinishedAt;
47 jack_client_state_t fStatus;
48
49 JackTimingMeasureClient()
50 :fRefNum(-1),
51 fSignaledAt(0),
52 fAwakeAt(0),
53 fFinishedAt(0),
54 fStatus((jack_client_state_t)0)
55 {}
56
57 } POST_PACKED_STRUCTURE;
58
63 PRE_PACKED_STRUCTURE
64 struct JackTimingClientInterval
65 {
66 int fRefNum;
67 char fName[JACK_CLIENT_NAME_SIZE + 1];
68 int fBeginInterval;
69 int fEndInterval;
70
71 JackTimingClientInterval()
72 :fRefNum(-1),
73 fBeginInterval(-1),
74 fEndInterval(-1)
75 {}
76
77 } POST_PACKED_STRUCTURE;
78
83 PRE_PACKED_STRUCTURE
84 struct JackTimingMeasure
85 {
86 unsigned int fAudioCycle;
87 jack_time_t fPeriodUsecs;
88 jack_time_t fCurCycleBegin;
89 jack_time_t fPrevCycleEnd;
90 JackTimingMeasureClient fClientTable[CLIENT_NUM];
91
92 JackTimingMeasure()
93 :fAudioCycle(0),
94 fPeriodUsecs(0),
95 fCurCycleBegin(0),
96 fPrevCycleEnd(0)
97 {}
98
99 } POST_PACKED_STRUCTURE;
100
105 class JackClientInterface;
106 class JackGraphManager;
107
108 PRE_PACKED_STRUCTURE
109 class SERVER_EXPORT JackEngineProfiling
110 {
111
112 private:
113
114 JackTimingMeasure fProfileTable[TIME_POINTS];
115 JackTimingClientInterval fIntervalTable[MEASURED_CLIENTS];
116
117 unsigned int fAudioCycle;
118 unsigned int fMeasuredClient;
119
120 bool CheckClient(const char* name, int cur_point);
121
122 public:
123
124 JackEngineProfiling();
125 ~JackEngineProfiling();
126
127 void Profile(JackClientInterface** table,
128 JackGraphManager* manager,
129 jack_time_t period_usecs,
130 jack_time_t cur_cycle_begin,
131 jack_time_t prev_cycle_end);
132
133 JackTimingMeasure* GetCurMeasure();
134
135 } POST_PACKED_STRUCTURE;
136
137 } // end of namespace
138
139 #endif
Jack::JackTimingClientInterval
Timing interval in the global table for a given client.
Definition: JackEngineProfiling.h:64
Jack::JackGraphManager
Graph manager: contains the connection manager and the port array.
Definition: JackGraphManager.h:40
Jack::JackTimingMeasureClient
Timing stucture for a client.
Definition: JackEngineProfiling.h:41
Jack::JackTimingMeasure
Timing stucture for a table of clients.
Definition: JackEngineProfiling.h:84
Jack::JackClientInterface
Client interface.
Definition: JackClientInterface.h:35
Jack::JackEngineProfiling
Definition: JackEngineProfiling.h:109