00001 00008 /* (c) 2004 Technische Universitaet Dresden 00009 * This file is part of DROPS, which is distributed under the terms of the 00010 * GNU General Public License 2. Please see the COPYING file for details. 00011 */ 00012 #ifndef __RT_MON_INCLUDE_TYPES_H_ 00013 #define __RT_MON_INCLUDE_TYPES_H_ 00014 00015 #include <l4/dm_generic/types.h> 00016 00017 #include <l4/rt_mon/defines.h> 00018 00019 00020 /********************************************************************* 00021 * Time sources 00022 *********************************************************************/ 00023 00024 // reserve 0 as illegal value ! 00025 #define RT_MON_ILLEGAL_TIME 0 00026 #define RT_MON_TSC_TIME 2 00029 #define RT_MON_TSC_TO_US_TIME 3 00033 #define RT_MON_THREAD_TIME 1 00037 #define RT_MON_FAST_THREAD_TIME 4 00043 #define RT_MON_FAST_THREAD_TIME_TSC 5 00048 /********************************************************************* 00049 * Simple types 00050 *********************************************************************/ 00051 00052 typedef signed long long rt_mon_time_t; 00053 00054 00055 /********************************************************************* 00056 * Structure types 00057 *********************************************************************/ 00058 00059 #define RT_MON_TYPE_UNDEFINED 0 00060 #define RT_MON_TYPE_HISTOGRAM 1 00061 #define RT_MON_TYPE_HISTOGRAM2D 2 00062 #define RT_MON_TYPE_EVENT_LIST 3 00063 #define RT_MON_TYPE_SHARED_LIST 4 00064 #define RT_MON_TYPE_SCALAR 5 00065 00066 /* Allocate with: 00067 * 'hist = malloc(sizeof(rt_mon_histogram_t) + 00068 * sizeof(rt_mon_histogram_t.data[0]) * bins * layers);' 00069 */ 00070 typedef struct 00071 { 00072 int type; // identifies the type of struct 00073 int id; // identifies the instance 00074 int clock; // clock type to use (e.g. TSC, process time, ...) 00075 char name[RT_MON_NAME_LENGTH]; 00076 char unit[2][RT_MON_NAME_LENGTH]; // time units (e.g., 'ms', 'µs') 00077 l4dm_dataspace_t ds; // points to self 00078 double low; // lower bound for histogram data (inclusive) 00079 double high; // upper bound for histogram data (exclusive) 00080 00081 long long low_int; // lower bound as an integer 00082 long long bin_int_scaler; // scaler for integer calculation 00083 00084 double bin_size; // precomputed multiplier 00085 unsigned int time_ovh; // overhead for time measurements 00086 int bins; // number of bins in histogram 00087 unsigned int underflow; // number of underflows (value below low) occurred 00088 unsigned int overflow; // number of overflows (value above high) occurred 00089 unsigned int lost; // number of lost data 00090 00091 long long val_min; // minimum value put in so far 00092 long long val_max; // maximum value put in so far 00093 unsigned val_count; // number of values in the histogram 00094 long long val_sum; // sum of the values in the histogram 00095 00096 rt_mon_time_t start; // temp. beginning of duration 00097 rt_mon_time_t end; // temp. end of duration 00098 unsigned int data[0]; // data points 00099 } rt_mon_histogram_t; 00100 00101 /* Allocate with: 00102 * 'hist = malloc(sizeof(rt_mon_histogram2d_t) + 00103 * sizeof(rt_mon_histogram2d_t.data[0]) * bins[0] * bins[1]);' 00104 */ 00105 typedef struct 00106 { 00107 int type; // identifies the type of struct 00108 int id; // identifies the instance 00109 int clock; // clock type to use (e.g. TSC, process time, ...) 00110 char name[RT_MON_NAME_LENGTH]; 00111 char unit[3][RT_MON_NAME_LENGTH]; // time units (e.g., 'ms', 'µs') 00112 l4dm_dataspace_t ds; // points to self 00113 double low[2]; // lower bound for histogram data (inclusive) 00114 double high[2]; // upper bound for histogram data (exclusive) 00115 double bin_size[2]; // precomputed multiplier 00116 unsigned int time_ovh; // overhead for time measurements 00117 int bins[2]; // number of bins in histogram 00118 int layers; // number of layers in the histogram 00119 unsigned int underflow; // number of underflows (value below low) occurred 00120 unsigned int overflow; // number of overflows (value above high) occurred 00121 rt_mon_time_t start; // temp. beginning of duration 00122 rt_mon_time_t end; // temp. end of duration 00123 unsigned int data[0]; // data points 00124 } rt_mon_histogram2d_t; 00125 00126 00127 /* Allocate with: 00128 * 'list = malloc(sizeof(rt_mon_event_list_t) + sizeof(event_t) * events);' 00129 * Specific event types are to be defined elsewhere 00130 */ 00131 typedef struct 00132 { 00133 int type; // identifies the type of struct 00134 int id; // identifies the instance 00135 int clock; // clock type to use (e.g. TSC, ...) 00136 char name[RT_MON_NAME_LENGTH]; 00137 char unit[RT_MON_NAME_LENGTH]; // time units (e.g., 'ms', 'µs') 00138 l4dm_dataspace_t ds; // points to self 00139 int event_type; // type of all events 00140 int event_size; // size of a single event in bytes 00141 unsigned int insert; // position of next insertion 00142 unsigned int remove; // position of next removal 00143 int max_events; // maximal number of events in list 00144 int overruns; // # of events lost due to memory shortage 00145 int data[0]; // the events to be stored, must be casted 00146 } rt_mon_event_list_t; 00147 00148 typedef struct 00149 { 00150 int type; // identifies the type of struct 00151 int id; // identifies the instance 00152 int clock; // clock type to use (e.g. TSC, ...) 00153 char name[RT_MON_NAME_LENGTH]; 00154 char unit[RT_MON_NAME_LENGTH]; // time units (e.g., 'ms', 'µs') 00155 l4dm_dataspace_t ds; // points to self 00156 00157 rt_mon_time_t low; // lower bound for valid range 00158 rt_mon_time_t high; // upper bound for valid range 00159 rt_mon_time_t val_min; // minimum value put in so far 00160 rt_mon_time_t val_max; // maximum value put in so far 00161 long long val_count; // number of values inserted 00162 rt_mon_time_t val_sum; // sum of all values inserted 00163 rt_mon_time_t data; // finally the data itself 00164 } rt_mon_scalar_t; 00165 00166 00167 /* Generic data type to be monitored, useful for type detection. 00168 * Union of all structure types 00169 */ 00170 typedef union 00171 { 00172 int type; 00173 rt_mon_histogram_t hist; 00174 rt_mon_histogram2d_t hist2d; 00175 rt_mon_event_list_t list; 00176 rt_mon_scalar_t scalar; 00177 } rt_mon_data; 00178 00179 00180 /********************************************************************* 00181 * Event types 00182 *********************************************************************/ 00183 00184 #define RT_MON_EVTYPE_UNDEFINED 0 00185 #define RT_MON_EVTYPE_BASIC 1 00186 #define RT_MON_EVTYPE_VIDEO 2 00187 00188 typedef struct // RT_MON_EVTYPE_BASIC 00189 { 00190 int id; // event type, defined elsewhere 00191 rt_mon_time_t time; // time stamp of events occurrence, or duration 00192 int data; // a little bit of event-specific data 00193 } rt_mon_basic_event_t; 00194 00195 typedef struct // RT_MON_EVTYPE_VIDEO 00196 { 00197 int id; // frame type 00198 rt_mon_time_t time; // processing time 00199 int data1; 00200 int data2; 00201 int data3; 00202 } rt_mon_video_event_t; 00203 00204 typedef struct 00205 { 00206 int committed; // flag if packet is committed (== 1) or not (== 0) 00207 int data[0]; // place holder for actual event 00208 } rt_mon_event_container_t; 00209 00210 00211 /********************************************************************* 00212 * Other stuff 00213 *********************************************************************/ 00214 00215 // transfer type for idl 00216 typedef struct 00217 { 00218 int id; 00219 char name[RT_MON_NAME_LENGTH]; 00220 } rt_mon_dss; 00221 00222 #endif