comparison VMS.h @ 40:1df8d7f2c9b1

Added measurement of suspend time and master time Weird suspend-time histogram -- will try moving hist update out of coreloop and into app
author Me
date Sat, 11 Sep 2010 03:26:07 -0700
parents e69579a0e797
children cf3e9238aeb0
comparison
equal deleted inserted replaced
12:77fe3230b77d 13:a51468cceec9
10 #define _VMS_H 10 #define _VMS_H
11 #define __USE_GNU 11 #define __USE_GNU
12 12
13 #include "VMS_primitive_data_types.h" 13 #include "VMS_primitive_data_types.h"
14 #include "Queue_impl/BlockingQueue.h" 14 #include "Queue_impl/BlockingQueue.h"
15 #include "Histogram/Histogram.h"
15 #include <pthread.h> 16 #include <pthread.h>
16 17
17 //When DEBUG is defined, VMS does sequential exe in the main thread 18 //When DEBUG is defined, VMS does sequential exe in the main thread
18 // It still does co-routines and all the mechanisms are the same, it just 19 // It still does co-routines and all the mechanisms are the same, it just
19 // has only a single thread and animates VPs one at a time 20 // has only a single thread and animates VPs one at a time
20 //#define DEBUG 21 #define SEQUENTIAL
22
23 //when MEAS__TAKE_SUSP_TSC is defined, causes code to be inserted and
24 // compiled-in that saves the low part of the time stamp count just before
25 // suspending a processor and just after resuming that processor. It is
26 // saved into a field added to VirtProcr. Have to sanity-check for
27 // rollover of low portion into high portion.
28 #define MEAS__TIME_STAMP_SUSP
29 #define MEAS__TIME_MASTER
30 #define MEAS__NUM_TIMES_TO_RUN 100000
21 31
22 //This value is the number of hardware threads in the shared memory 32 //This value is the number of hardware threads in the shared memory
23 // machine 33 // machine
24 #define NUM_CORES 4 34 #define NUM_CORES 4
25 35
57 67
58 typedef struct 68 typedef struct
59 { 69 {
60 void *endThdPt; 70 void *endThdPt;
61 unsigned int coreNum; 71 unsigned int coreNum;
62 // void *framePtr;
63 // void *stackPtr;
64 } 72 }
65 ThdParams; 73 ThdParams;
66 74
67 75
68 struct _SchedSlot 76 struct _SchedSlot
107 115
108 SchedSlot *schedSlot; 116 SchedSlot *schedSlot;
109 VMSReqst *requests; 117 VMSReqst *requests;
110 118
111 void *semanticData; 119 void *semanticData;
120
121 //============================= MEASUREMENT STUFF ========================
122 #ifdef MEAS__TIME_STAMP_SUSP
123 unsigned int preSuspTSCLow;
124 unsigned int postSuspTSCLow;
125 #endif
126 #ifdef MEAS__TIME_MASTER
127 unsigned int startMasterTSCLow;
128 unsigned int endMasterTSCLow;
129 #endif
130 //========================================================================
112 }; 131 };
113 //VirtProcr 132 //VirtProcr
114 133
115 134
116 135
129 void *coreLoopStartPt;//addr to jump to to re-enter coreLoop 148 void *coreLoopStartPt;//addr to jump to to re-enter coreLoop
130 void *coreLoopEndPt; //addr to jump to to shut down a coreLoop 149 void *coreLoopEndPt; //addr to jump to to shut down a coreLoop
131 150
132 int setupComplete; 151 int setupComplete;
133 int masterLock; 152 int masterLock;
153
154 //============================= MEASUREMENT STUFF ========================
155 #ifdef MEAS__TIME_STAMP_SUSP
156 Histogram *measSuspHist;
157 #endif
158 #ifdef MEAS__TIME_MASTER
159 Histogram *measMasterHist;
160 #endif
161 //========================================================================
134 } 162 }
135 MasterEnv; 163 MasterEnv;
136 164
137 165
138 //========================================================== 166 //==========================================================
174 //========================== 202 //==========================
175 inline void 203 inline void
176 VMS__add_sem_request( void *semReqData, VirtProcr *callingPr ); 204 VMS__add_sem_request( void *semReqData, VirtProcr *callingPr );
177 205
178 void 206 void
179 VMS__send_register_new_procr_request( VirtProcr *newPrToRegister, 207 VMS__send_req_to_register_new_procr( VirtProcr *newPrToRegister,
180 VirtProcr *reqstingPr ); 208 VirtProcr *reqstingPr );
181 209
182 void 210 void
183 VMS__free_request( VMSReqst *req ); 211 VMS__free_request( VMSReqst *req );
184 212
232 /* outputs */ : "=m" (low), "=m" (high)\ 260 /* outputs */ : "=m" (low), "=m" (high)\
233 /* inputs */ : \ 261 /* inputs */ : \
234 /* clobber */ : "%eax", "%edx" \ 262 /* clobber */ : "%eax", "%edx" \
235 ); 263 );
236 264
265 #define saveLowTimeStampCountInto(low) \
266 asm volatile("RDTSC; \
267 movl %%eax, %0;" \
268 /* outputs */ : "=m" (low) \
269 /* inputs */ : \
270 /* clobber */ : "%eax", "%edx" \
271 );
272
237 inline TSCount getTSCount(); 273 inline TSCount getTSCount();
238 274
239 //===================== Debug ========================== 275 //===================== Debug ==========================
240 int numProcrsCreated; 276 int numProcrsCreated;
241 277