comparison VMS.h @ 76:9ddbb071142d

make hardware independent and port to 64bit
author Merten Sach <msach@mailbox.tu-berlin.de>
date Thu, 16 Jun 2011 14:41:15 +0200
parents d8f12351f7cc
children fe5ec83f1baf
comparison
equal deleted inserted replaced
40:284156c6cb94 41:356cabb041cf
6 * 6 *
7 */ 7 */
8 8
9 #ifndef _VMS_H 9 #ifndef _VMS_H
10 #define _VMS_H 10 #define _VMS_H
11 #define __USE_GNU 11 #define _GNU_SOURCE
12 12
13 #include "VMS_primitive_data_types.h" 13 #include "VMS_primitive_data_types.h"
14 #include "Queue_impl/PrivateQueue.h" 14 #include "Queue_impl/PrivateQueue.h"
15 #include "Histogram/Histogram.h" 15 #include "Histogram/Histogram.h"
16 #include "DynArray/DynArray.h" 16 #include "DynArray/DynArray.h"
17 #include "Hash_impl/PrivateHash.h" 17 #include "Hash_impl/PrivateHash.h"
18 #include "vmalloc.h" 18 #include "vmalloc.h"
19 19
20 //#include <stdio.h>
21 #include <pthread.h> 20 #include <pthread.h>
22 #include <sys/time.h> 21 #include <sys/time.h>
23 22
24 23
25 //=============================== Debug =================================== 24 //=============================== Debug ===================================
26 // 25 //
27 //When SEQUENTIAL is defined, VMS does sequential exe in the main thread 26 //When SEQUENTIAL is defined, VMS does sequential exe in the main thread
28 // It still does co-routines and all the mechanisms are the same, it just 27 // It still does co-routines and all the mechanisms are the same, it just
29 // has only a single thread and animates VPs one at a time 28 // has only a single thread and animates VPs one at a time
30 //#define SEQUENTIAL 29 //#define SEQUENTIAL
31 30
32 //#define USE_WORK_STEALING 31 //#define USE_WORK_STEALING
33 32
34 //turns on the probe-instrumentation in the application -- when not 33 //turns on the probe-instrumentation in the application -- when not
35 // defined, the calls to the probe functions turn into comments 34 // defined, the calls to the probe functions turn into comments
36 #define STATS__ENABLE_PROBES 35 #define STATS__ENABLE_PROBES
37 //#define TURN_ON_DEBUG_PROBES 36 //#define TURN_ON_DEBUG_PROBES
38 37
39 //These defines turn types of bug messages on and off 38 //These defines turn types of bug messages on and off
40 // be sure debug messages are un-commented (next block of defines) 39 // be sure debug messages are un-commented (next block of defines)
41 #define dbgAppFlow TRUE /* Top level flow of application code -- general*/ 40 #define dbgAppFlow TRUE /* Top level flow of application code -- general*/
42 #define dbgProbes FALSE /* for issues inside probes themselves*/ 41 #define dbgProbes FALSE /* for issues inside probes themselves*/
43 #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ 42 #define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/
44 #define dbgRqstHdlr FALSE /* in request handler code*/ 43 #define dbgRqstHdlr FALSE /* in request handler code*/
45 44
46 //Comment or un- the substitute half to turn on/off types of debug message 45 //Comment or un- the substitute half to turn on/off types of debug message
47 #define DEBUG( bool, msg) \ 46 #define DEBUG( bool, msg) \
48 // if( bool){ printf(msg); fflush(stdin);} 47 // if( bool){ printf(msg); fflush(stdin);}
49 #define DEBUG1( bool, msg, param) \ 48 #define DEBUG1( bool, msg, param) \
50 // if(bool){printf(msg, param); fflush(stdin);} 49 // if(bool){printf(msg, param); fflush(stdin);}
51 #define DEBUG2( bool, msg, p1, p2) \ 50 #define DEBUG2( bool, msg, p1, p2) \
52 // if(bool) {printf(msg, p1, p2); fflush(stdin);} 51 // if(bool) {printf(msg, p1, p2); fflush(stdin);}
53 52
54 #define ERROR(msg) printf(msg); //fflush(stdin); 53 #define ERROR(msg) printf(msg);
55 #define ERROR1(msg, param) printf(msg, param); fflush(stdin); 54 #define ERROR1(msg, param) printf(msg, param);
56 #define ERROR2(msg, p1, p2) printf(msg, p1, p2); fflush(stdin); 55 #define ERROR2(msg, p1, p2) printf(msg, p1, p2);
57 56
58 //=========================== STATS ======================= 57 //=========================== STATS =======================
59 58
60 //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and 59 //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and
61 // compiled-in that saves the low part of the time stamp count just before 60 // compiled-in that saves the low part of the time stamp count just before
62 // suspending a processor and just after resuming that processor. It is 61 // suspending a processor and just after resuming that processorsrc/VPThread_lib/VMS/VMS.h:322: warning: previous declaration of ‘VMS__create_procr’ was here. It is
63 // saved into a field added to VirtProcr. Have to sanity-check for 62 // saved into a field added to VirtProcr. Have to sanity-check for
64 // rollover of low portion into high portion. 63 // rollover of low portion into high portion.
65 //#define MEAS__TIME_STAMP_SUSP 64 //#define MEAS__TIME_STAMP_SUSP
66 //#define MEAS__TIME_MASTER 65 //#define MEAS__TIME_MASTER
67 #define MEAS__TIME_PLUGIN 66 #define MEAS__TIME_PLUGIN
186 void *initialData; 185 void *initialData;
187 186
188 SchedSlot *schedSlot; 187 SchedSlot *schedSlot;
189 VMSReqst *requests; 188 VMSReqst *requests;
190 189
191 void *semanticData; //this lives here for the life of VP 190 void *semanticData; //this livesUSE_GNU here for the life of VP
192 void *dataRetFromReq;//values returned from plugin to VP go here 191 void *dataRetFromReq;//values returned from plugin to VP go here
193 192
194 //=========== MEASUREMENT STUFF ========== 193 //=========== MEASUREMENT STUFF ==========
195 #ifdef MEAS__TIME_STAMP_SUSP 194 #ifdef MEAS__TIME_STAMP_SUSP
196 unsigned int preSuspTSCLow; 195 unsigned int preSuspTSCLow;
197 unsigned int postSuspTSCLow; 196 unsigned int postSuspTSCLow;
198 #endif 197 #endif
199 #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/ 198 #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/
200 unsigned int startMasterTSCLow; 199 unsigned int startMasterTSCLow;USE_GNU
201 unsigned int endMasterTSCLow; 200 unsigned int endMasterTSCLow;
202 #endif 201 #endif
203 //======================================== 202 //========================================
204 203
205 float64 createPtInSecs; //have space but don't use on some configs 204 float64 createPtInSecs; //have space but don't use on some configs
317 VMS__start_the_work_then_wait_until_done(); 316 VMS__start_the_work_then_wait_until_done();
318 317
319 void 318 void
320 VMS__start_the_work_then_wait_until_done_Seq(); 319 VMS__start_the_work_then_wait_until_done_Seq();
321 320
322 VirtProcr * 321 inline VirtProcr *
323 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData ); 322 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
324 323
325 void 324 void
326 VMS__dissipate_procr( VirtProcr *procrToDissipate ); 325 VMS__dissipate_procr( VirtProcr *procrToDissipate );
327 326
372 inline void * 371 inline void *
373 VMS__take_sem_reqst_from( VMSReqst *req ); 372 VMS__take_sem_reqst_from( VMSReqst *req );
374 373
375 //======================== STATS ====================== 374 //======================== STATS ======================
376 375
377 //===== RDTSC wrapper ===== 376 //===== RDTSC wrapper ===== //Also runs with x86_64 code
378 377
379 #define saveTimeStampCountInto(low, high) \ 378 #define saveTimeStampCountInto(low, high) \
380 asm volatile("RDTSC; \ 379 asm volatile("RDTSC; \
381 movl %%eax, %0; \ 380 movl %%eax, %0; \
382 movl %%edx, %1;" \ 381 movl %%edx, %1;" \
409 #define mutexLockHistIdx 2 408 #define mutexLockHistIdx 2
410 #define mutexUnlockHistIdx 3 409 #define mutexUnlockHistIdx 3
411 #define condWaitHistIdx 4 410 #define condWaitHistIdx 4
412 #define condSignalHistIdx 5 411 #define condSignalHistIdx 5
413 412
414 #define MakeTheMeasHists \ 413 #define MakeTheMeasHists() \
415 _VMSMasterEnv->measHistsInfo = \ 414 _VMSMasterEnv->measHistsInfo = \
416 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ 415 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \
417 makeAMeasHist( createHistIdx, "Create", 50, 0, 100 ) \ 416 makeAMeasHist( createHistIdx, "Create", 50, 0, 100 ) \
418 makeAMeasHist( mutexLockHistIdx, "mutex lock", 50, 0, 100 ) \ 417 makeAMeasHist( mutexLockHistIdx, "mutex lock", 50, 0, 100 ) \
419 makeAMeasHist( mutexUnlockHistIdx, "mutex unlock", 50, 0, 100 ) \ 418 makeAMeasHist( mutexUnlockHistIdx, "mutex unlock", 50, 0, 100 ) \
427 426
428 //VCilk 427 //VCilk
429 #define spawnHistIdx 1 428 #define spawnHistIdx 1
430 #define syncHistIdx 2 429 #define syncHistIdx 2
431 430
432 #define MakeTheMeasHists \ 431 #define MakeTheMeasHists() \
433 _VMSMasterEnv->measHistsInfo = \ 432 _VMSMasterEnv->measHistsInfo = \
434 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ 433 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \
435 makeAMeasHist( spawnHistIdx, "Spawn", 50, 0, 200 ) \ 434 makeAMeasHist( spawnHistIdx, "Spawn", 50, 0, 200 ) \
436 makeAMeasHist( syncHistIdx, "Sync", 50, 0, 200 ) 435 makeAMeasHist( syncHistIdx, "Sync", 50, 0, 200 )
437 436
444 #define SendFromToHistIdx 1 443 #define SendFromToHistIdx 1
445 #define SendOfTypeHistIdx 2 444 #define SendOfTypeHistIdx 2
446 #define ReceiveFromToHistIdx 3 445 #define ReceiveFromToHistIdx 3
447 #define ReceiveOfTypeHistIdx 4 446 #define ReceiveOfTypeHistIdx 4
448 447
449 #define MakeTheMeasHists \ 448 #define MakeTheMeasHists() \
450 _VMSMasterEnv->measHistsInfo = \ 449 _VMSMasterEnv->measHistsInfo = \
451 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ 450 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \
452 makeAMeasHist( SendFromToHistIdx, "SendFromTo", 50, 0, 100 ) \ 451 makeAMeasHist( SendFromToHistIdx, "SendFromTo", 50, 0, 100 ) \
453 makeAMeasHist( SendOfTypeHistIdx, "SendOfType", 50, 0, 100 ) \ 452 makeAMeasHist( SendOfTypeHistIdx, "SendOfType", 50, 0, 100 ) \
454 makeAMeasHist( ReceiveFromToHistIdx,"ReceiveFromTo", 50, 0, 100 ) \ 453 makeAMeasHist( ReceiveFromToHistIdx,"ReceiveFromTo", 50, 0, 100 ) \