1 2 /* 3 * Copyright (C) Texas Instruments - http://www.ti.com/ 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #ifndef __PERF_RT_H 23 #define __PERF_RT_H 24 25 /* ============================================================================ 26 DEBUG STRUCTURES 27 ============================================================================ */ 28 typedef struct PERF_RTdata_uptime 29 { 30 /* data needed for uptime calculations */ 31 double start_uptime; 32 double start_idletime; 33 double last_uptime; 34 double last_idletime; 35 int measuring; 36 int success; 37 38 /* statistics */ 39 long n; 40 double x, xx; 41 42 /* real-time data */ 43 TIME_STRUCT last_reporting; 44 } PERF_RTdata_uptime; 45 46 typedef struct PERF_RTdata_rate 47 { 48 /* rate parameters */ 49 PERF_MODULETYPE modulesAndFlags; 50 unsigned long size; 51 52 /* data needed for frame rate calculations */ 53 TIME_STRUCT last_timestamp; 54 int skip; 55 56 /* statistics: 57 n, x, xx: whole lifecycle 58 tn, tx, txx: temporal statistics (for grandularity) 59 tn0: tn in the last temporal statistics phase (since the last executing phase) 60 if frame rate is less than 0.5fps and tn0 is less than 10 in the last phase, 61 we ignore and do not print the frames unless debug & 4 is set. 62 an, ax, axx: average temporal statistics - yields stdev */ 63 long n, tn, tn0, an; 64 unsigned long x, tx; 65 double xx, txx, ax, axx; 66 67 /* real-time data */ 68 TIME_STRUCT last_reporting; 69 } PERF_RTdata_rate; 70 71 typedef struct PERF_RTdata_delay 72 { 73 /* delay parameters */ 74 /* NONE for now */ 75 76 /* data needed for delay calculations */ 77 TIME_STRUCT last_timestamp; 78 79 /* statistics: this is real-time in nature, so no "buffering" is performed. 80 therefore, no need for temporal statistics 81 */ 82 long n; 83 unsigned long x; 84 double xx; 85 } PERF_RTdata_delay; 86 87 typedef struct PERF_RTdata_sts 88 { 89 int capturing; 90 unsigned long size_min, size_max; 91 92 unsigned long last_burst; /* last burst so we don't count the 93 last delay of each raw burst into 94 the modified number */ 95 96 PERF_RTdata_delay dSingle; /* single shot-to-shot */ 97 PERF_RTdata_delay dBurst, dABurst; /* raw burst, average of all bursts */ 98 PERF_RTdata_delay dBurst2, dABurst2; /* modified burst, average */ 99 } PERF_RTdata_sts; 100 101 typedef struct PERF_RT_Private 102 { 103 /* configuration */ 104 FILE *fRt; /* file to real-time output (Buffer) */ 105 long granularity; 106 int summary; 107 int detailed; 108 int debug; /* bit: 1 & any - print temporal stats 109 2 - print difference between temporal average and true average 110 4 - use all frames for rates, not just after 10 frames 111 */ 112 113 /* state data for reporting */ 114 TIME_STRUCT first_time; 115 116 /* uptime data */ 117 struct PERF_RTdata_uptime *dUptime; /* uptime data */ 118 119 /* rate data */ 120 int steadyState; /* are we in steady state? */ 121 int needSteadyState; /* do we need steady state? */ 122 struct PERF_RTdata_rate *dRate; /* rate data */ 123 int nDRate; /* number of dRate structures */ 124 int maxDRate; /* maximum number of dRates */ 125 int encoder; /* encoder, sending arbitrary sizes */ 126 int decoder; /* decoder, receiving arbitrary sizes */ 127 unsigned long only_moduleandflags; /* the module and flags we care about - if detailed is 0 */ 128 129 /* shot-to-shot data */ 130 struct PERF_RTdata_sts *dSTS; /* single-shot and burst modes */ 131 132 } PERF_RT_Private; 133 134 void 135 PERF_RT_done(PERF_Private *perf); 136 137 PERF_RT_Private * 138 PERF_RT_create(PERF_Private *perf, PERF_Config *config, PERF_MODULETYPE eModule); 139 140 void 141 __rt_Boundary(PERF_Private *perf,PERF_BOUNDARYTYPE eBoundary); 142 143 void 144 __rt_Buffer(PERF_Private *perf,unsigned long ulAddress1, 145 unsigned long ulAddress2, 146 unsigned long ulSize, 147 PERF_MODULETYPE eModule); 148 149 void 150 __rt_Command(PERF_Private *perf, 151 unsigned long ulCommand, 152 unsigned long ulArgument, 153 PERF_MODULETYPE eModule); 154 155 void 156 __rt_Create(PERF_Private *perf); 157 158 void 159 __rt_Done(PERF_Private *perf); 160 161 void 162 __rt_Log(PERF_Private *perf, 163 unsigned long ulData1, unsigned long ulData2, 164 unsigned long ulData3); 165 166 void 167 __rt_SyncAV(PERF_Private *perf, 168 float pfTimeAudio, 169 float pfTimeVideo, 170 PERF_SYNCOPTYPE eSyncOperation); 171 172 void 173 __rt_ThreadCreated(PERF_Private *perf, 174 unsigned long ulThreadID, 175 unsigned long ulThreadName); 176 177 #endif 178 179