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.
41 struct JackTimingMeasureClient
44 jack_time_t fSignaledAt
;
46 jack_time_t fFinishedAt
;
47 jack_client_state_t fStatus
;
49 JackTimingMeasureClient()
54 fStatus((jack_client_state_t
)0)
57 } POST_PACKED_STRUCTURE
;
60 \brief Timing interval in the global table for a given client
64 struct JackTimingClientInterval
67 char fName
[JACK_CLIENT_NAME_SIZE
+ 1];
71 JackTimingClientInterval()
77 } POST_PACKED_STRUCTURE
;
80 \brief Timing stucture for a table of clients.
84 struct JackTimingMeasure
86 unsigned int fAudioCycle
;
87 jack_time_t fPeriodUsecs
;
88 jack_time_t fCurCycleBegin
;
89 jack_time_t fPrevCycleEnd
;
90 JackTimingMeasureClient fClientTable
[CLIENT_NUM
];
99 } POST_PACKED_STRUCTURE
;
102 \brief Client timing monitoring.
105 class JackClientInterface
;
106 class JackGraphManager
;
109 class SERVER_EXPORT JackEngineProfiling
114 JackTimingMeasure fProfileTable
[TIME_POINTS
];
115 JackTimingClientInterval fIntervalTable
[MEASURED_CLIENTS
];
117 unsigned int fAudioCycle
;
118 unsigned int fMeasuredClient
;
120 bool CheckClient(const char* name
, int cur_point
);
124 JackEngineProfiling();
125 ~JackEngineProfiling();
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
);
133 JackTimingMeasure
* GetCurMeasure();
135 } POST_PACKED_STRUCTURE
;
137 } // end of namespace