2 Copyright (C) 2008 Grame & RTL
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.
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.
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.
20 #ifndef __JackEngineProfiling__
21 #define __JackEngineProfiling__
24 #include "JackTypes.h"
25 #include "JackConstants.h"
26 #include "JackShmMem.h"
31 #define TIME_POINTS 100000
32 #define FAILURE_TIME_POINTS 10000
33 #define FAILURE_WINDOW 10
34 #define MEASURED_CLIENTS 32
37 \brief Timing stucture for a client.
40 struct JackTimingMeasureClient
43 jack_time_t fSignaledAt
;
45 jack_time_t fFinishedAt
;
46 jack_client_state_t fStatus
;
48 JackTimingMeasureClient()
53 fStatus((jack_client_state_t
)0)
56 } POST_PACKED_STRUCTURE
;
59 \brief Timing interval in the global table for a given client
62 struct JackTimingClientInterval
65 char fName
[JACK_CLIENT_NAME_SIZE
+ 1];
69 JackTimingClientInterval()
75 } POST_PACKED_STRUCTURE
;
78 \brief Timing stucture for a table of clients.
81 struct JackTimingMeasure
83 unsigned int fAudioCycle
;
84 jack_time_t fPeriodUsecs
;
85 jack_time_t fCurCycleBegin
;
86 jack_time_t fPrevCycleEnd
;
87 JackTimingMeasureClient fClientTable
[CLIENT_NUM
];
96 } POST_PACKED_STRUCTURE
;
99 \brief Client timing monitoring.
102 class JackClientInterface
;
103 class JackGraphManager
;
105 class SERVER_EXPORT JackEngineProfiling
110 JackTimingMeasure fProfileTable
[TIME_POINTS
];
111 JackTimingClientInterval fIntervalTable
[MEASURED_CLIENTS
];
113 unsigned int fAudioCycle
;
114 unsigned int fMeasuredClient
;
116 bool CheckClient(const char* name
, int cur_point
);
120 JackEngineProfiling();
121 ~JackEngineProfiling();
123 void Profile(JackClientInterface
** table
,
124 JackGraphManager
* manager
,
125 jack_time_t period_usecs
,
126 jack_time_t cur_cycle_begin
,
127 jack_time_t prev_cycle_end
);
129 JackTimingMeasure
* GetCurMeasure();
131 } POST_PACKED_STRUCTURE
;
133 } // end of namespace