comparison probes.c @ 200:6db9e4898978

VMS name chgs -- added "WL" "PI" and "int" and split vms.h up
author Me@portablequad
date Sun, 12 Feb 2012 01:49:33 -0800
parents 7cff4e13d5c4
children
comparison
equal deleted inserted replaced
11:0d7faa583cdf 13:9ad3172e746f
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <malloc.h> 8 #include <malloc.h>
9 #include <sys/time.h> 9 #include <sys/time.h>
10 10
11 #include "VMS.h" 11 #include "VMS.h"
12 #include "Queue_impl/BlockingQueue.h"
13 #include "Histogram/Histogram.h"
14
15
16 //================================ STATS ====================================
17
18 inline TSCount getTSCount()
19 { unsigned int low, high;
20 TSCount out;
21
22 saveTimeStampCountInto( low, high );
23 out = high;
24 out = (out << 32) + low;
25 return out;
26 }
27 12
28 13
29 14
30 //==================== Probes ================= 15 //==================== Probes =================
31 #ifdef STATS__USE_TSC_PROBES 16 #ifdef STATS__USE_TSC_PROBES
106 * For now, just making so that probe creation causes a suspend, so that 91 * For now, just making so that probe creation causes a suspend, so that
107 * the dynamic array in the master env is only modified from the master 92 * the dynamic array in the master env is only modified from the master
108 * 93 *
109 */ 94 */
110 IntervalProbe * 95 IntervalProbe *
111 create_generic_probe( char *nameStr, VirtProcr *animPr ) 96 create_generic_probe( char *nameStr, SlaveVP *animPr )
112 { 97 {
113 VMSSemReq reqData; 98 VMSSemReq reqData;
114 99
115 reqData.reqType = createProbe; 100 reqData.reqType = createProbe;
116 reqData.nameStr = nameStr; 101 reqData.nameStr = nameStr;
117 102
118 VMS__send_VMSSem_request( &reqData, animPr ); 103 VMS_WL__send_VMSSem_request( &reqData, animPr );
119 104
120 return animPr->dataRetFromReq; 105 return animPr->dataRetFromReq;
121 } 106 }
122 107
123 /*Use this version from outside VMS -- it uses external malloc, and modifies 108 /*Use this version from outside VMS -- it uses external malloc, and modifies
144 /*Only call from inside master or main startup/shutdown thread 129 /*Only call from inside master or main startup/shutdown thread
145 */ 130 */
146 void 131 void
147 VMS_impl__free_probe( IntervalProbe *probe ) 132 VMS_impl__free_probe( IntervalProbe *probe )
148 { if( probe->hist != NULL ) freeDblHist( probe->hist ); 133 { if( probe->hist != NULL ) freeDblHist( probe->hist );
149 if( probe->nameStr != NULL) VMS__free( probe->nameStr ); 134 if( probe->nameStr != NULL) VMS_int__free( probe->nameStr );
150 VMS__free( probe ); 135 VMS_int__free( probe );
151 } 136 }
152 137
153 138
154 int32 139 int32
155 VMS_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr) 140 VMS_impl__record_time_point_into_new_probe( char *nameStr, SlaveVP *animPr)
156 { IntervalProbe *newProbe; 141 { IntervalProbe *newProbe;
157 struct timeval *startStamp; 142 struct timeval *startStamp;
158 float64 startSecs; 143 float64 startSecs;
159 144
160 newProbe = create_generic_probe( nameStr, animPr ); 145 newProbe = create_generic_probe( nameStr, animPr );
188 173
189 return newProbe->probeID; 174 return newProbe->probeID;
190 } 175 }
191 176
192 int32 177 int32
193 VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ) 178 VMS_impl__create_single_interval_probe( char *nameStr, SlaveVP *animPr )
194 { IntervalProbe *newProbe; 179 { IntervalProbe *newProbe;
195 180
196 newProbe = create_generic_probe( nameStr, animPr ); 181 newProbe = create_generic_probe( nameStr, animPr );
197 182
198 return newProbe->probeID; 183 return newProbe->probeID;
199 } 184 }
200 185
201 int32 186 int32
202 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue, 187 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue,
203 float64 binWidth, char *nameStr, VirtProcr *animPr ) 188 float64 binWidth, char *nameStr, SlaveVP *animPr )
204 { IntervalProbe *newProbe; 189 { IntervalProbe *newProbe;
205 DblHist *hist; 190 DblHist *hist;
206 191
207 newProbe = create_generic_probe( nameStr, animPr ); 192 newProbe = create_generic_probe( nameStr, animPr );
208 193
210 newProbe->hist = hist; 195 newProbe->hist = hist;
211 return newProbe->probeID; 196 return newProbe->probeID;
212 } 197 }
213 198
214 void 199 void
215 VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr ) 200 VMS_impl__index_probe_by_its_name( int32 probeID, SlaveVP *animPr )
216 { IntervalProbe *probe; 201 { IntervalProbe *probe;
217 202
218 //TODO: fix this To be in Master -- race condition 203 //TODO: fix this To be in Master -- race condition
219 probe = _VMSMasterEnv->intervalProbes[ probeID ]; 204 probe = _VMSMasterEnv->intervalProbes[ probeID ];
220 205
221 addValueIntoTable(probe->nameStr, probe, _VMSMasterEnv->probeNameHashTbl); 206 addValueIntoTable(probe->nameStr, probe, _VMSMasterEnv->probeNameHashTbl);
222 } 207 }
223 208
224 IntervalProbe * 209 IntervalProbe *
225 VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr ) 210 VMS_impl__get_probe_by_name( char *probeName, SlaveVP *animPr )
226 { 211 {
227 //TODO: fix this To be in Master -- race condition 212 //TODO: fix this To be in Master -- race condition
228 return getValueFromTable( probeName, _VMSMasterEnv->probeNameHashTbl ); 213 return getValueFromTable( probeName, _VMSMasterEnv->probeNameHashTbl );
229 } 214 }
230 215
231 216
232 /*Everything is local to the animating procr, so no need for request, do 217 /*Everything is local to the animating procr, so no need for request, do
233 * work locally, in the anim Pr 218 * work locally, in the anim Pr
234 */ 219 */
235 void 220 void
236 VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animatingPr ) 221 VMS_impl__record_sched_choice_into_probe( int32 probeID, SlaveVP *animatingPr )
237 { IntervalProbe *probe; 222 { IntervalProbe *probe;
238 223
239 probe = _VMSMasterEnv->intervalProbes[ probeID ]; 224 probe = _VMSMasterEnv->intervalProbes[ probeID ];
240 probe->schedChoiceWasRecorded = TRUE; 225 probe->schedChoiceWasRecorded = TRUE;
241 probe->coreNum = animatingPr->coreAnimatedBy; 226 probe->coreNum = animatingPr->coreAnimatedBy;