Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 109:659299627e70 perf_counters
counters done
| author | Nina Engelhardt |
|---|---|
| date | Tue, 02 Aug 2011 17:16:12 +0200 |
| parents | 3bc3b89630c7 |
| children | 724c7a0b687f |
| files | CoreLoop.c Counters/Counters.c Counters/Counters.h MasterLoop.c ProcrContext.c VMS.c VMS.h |
| diffstat | 7 files changed, 126 insertions(+), 119 deletions(-) [+] |
line diff
1.1 --- a/CoreLoop.c Tue Jul 26 15:36:24 2011 +0200 1.2 +++ b/CoreLoop.c Tue Aug 02 17:16:12 2011 +0200 1.3 @@ -35,7 +35,7 @@ 1.4 { 1.5 ThdParams *coreLoopThdParams; 1.6 int thisCoresIdx; 1.7 - VirtProcr *currPr; 1.8 + VirtProcr *currPr = NULL; 1.9 VMSQueueStruc *readyToAnimateQ; 1.10 cpu_set_t coreMask; //has 1 in bit positions of allowed cores 1.11 int errorCode; 1.12 @@ -84,7 +84,17 @@ 1.13 1.14 1.15 while(1){ 1.16 - 1.17 + #ifdef MEAS__PERF_COUNTERS 1.18 + //end work 1.19 + 1.20 + if(currPr!=NULL){ 1.21 + int lastRecordIdx = currPr->counter_history_array_info->numInArray -1; 1.22 + CounterRecord* lastRecord = currPr->counter_history[lastRecordIdx]; 1.23 + //lastRecord->work_core = thisCoresIdx; 1.24 + saveCyclesAndInstrs(thisCoresIdx,lastRecord->suspend_cycles,lastRecord->suspend_instrs); 1.25 + } 1.26 + 1.27 + #endif 1.28 //Get virtual processor from queue 1.29 //The Q must be a global, static volatile var, so not kept in reg, 1.30 // which forces reloading the pointer after each jmp to this point 1.31 @@ -151,38 +161,15 @@ 1.32 1.33 } 1.34 1.35 - #ifdef MEAS__PERF_COUNTER 1.36 + #ifdef MEAS__PERF_COUNTERS 1.37 //start work 1.38 int lastRecordIdx = currPr->counter_history_array_info->numInArray -1; 1.39 CounterRecord* lastRecord = currPr->counter_history[lastRecordIdx]; 1.40 - lastRecord->work_core = thisCoresIdx; 1.41 - int cycles_fd = _VMSMasterEnv->cycles_counter_fd[thisCoresIdx]; 1.42 - int instrs_fd = _VMSMasterEnv->instrs_counter_fd[thisCoresIdx]; 1.43 - int nread; 1.44 - 1.45 - nread = read(cycles_fd,&(lastRecord->start_work_cycles),sizeof(lastRecord->start_work_cycles)); 1.46 - if(nread<0){ 1.47 - lastRecord->start_work_cycles = 0; 1.48 - } 1.49 - 1.50 - nread = read(instrs_fd,&(lastRecord->start_work_instrs),sizeof(lastRecord->start_work_instrs)); 1.51 - if(nread<0){ 1.52 - lastRecord->start_work_instrs = 0; 1.53 - } 1.54 + lastRecord->work_core = thisCoresIdx; 1.55 + saveCyclesAndInstrs(thisCoresIdx,lastRecord->start_work_cycles,lastRecord->start_work_instrs); 1.56 #endif 1.57 switchToVP(currPr); //The VPs return in here 1.58 - #ifdef MEAS__PERF_COUNTER 1.59 - //end work 1.60 - nread = read(cycles_fd,&(lastRecord->start_work_cycles),sizeof(lastRecord->start_work_cycles)); 1.61 - if(nread<0){ 1.62 - lastRecord->start_work_cycles = 0; 1.63 - } 1.64 1.65 - nread = read(instrs_fd,&(lastRecord->start_work_instrs),sizeof(lastRecord->start_work_instrs)); 1.66 - if(nread<0){ 1.67 - lastRecord->start_work_instrs = 0; 1.68 - } 1.69 - #endif 1.70 flushRegisters(); 1.71 }//CoreLoop 1.72 }
2.1 --- a/Counters/Counters.c Tue Jul 26 15:36:24 2011 +0200 2.2 +++ b/Counters/Counters.c Tue Aug 02 17:16:12 2011 +0200 2.3 @@ -2,13 +2,13 @@ 2.4 2.5 2.6 void print_record(CounterRecord* record){ 2.7 - printf("=== Loop Stats: ==="); 2.8 - printf("Constraints check done:\t%ld cycles, %ld instrs [Core %d]\n",record->sc_done_cycles,record->sc_done_instrs,record->req_core); 2.9 - printf("Ready Queue entered at:\t%ld cycles, %ld instrs [Core %d]\n",record->enter_readyQ_cycles,record->enter_readyQ_instrs,record->req_core); 2.10 - printf("Assigner started:\t%ld cycles, %ld instrs [Core %d]\n",record->start_assign_cycles,record->start_assign_instrs,record->assigning_core); 2.11 - printf("Assigner ended:\t%ld cycles, %ld instrs [Core %d]\n",record->end_assign_cycles,record->end_assign_instrs,record->assigning_core); 2.12 - printf("Work+comm started:\t%ld cycles, %ld instrs [Core %d]\n",record->start_work_cycles,record->start_work_instrs,record->work_core); 2.13 - printf("Work+comm ended:\t%ld cycles, %ld instrs [Core %d]\n",record->suspend_cycles,record->suspend_instrs,record->work_core); 2.14 - printf("Request read:\t%ld cycles, %ld instrs [Core %d]\n",record->req_cycles,record->req_instrs,record->req_core); 2.15 + printf("=== Loop Stats (VP %d): ===\n",record->vp_id); 2.16 + printf("Constraints check done:\t%lu cycles, %lu instrs [Core %d]\n",record->sc_done_cycles,record->sc_done_instrs,record->req_core); 2.17 + printf("Time in ready queue:\tblocked at %u, unblocked at %u\n",record->blocked_timestamp,record->unblocked_timestamp); 2.18 + printf("Assigner started:\t%lu cycles, %lu instrs [Core %d]\n",record->start_assign_cycles,record->start_assign_instrs,record->assigning_core); 2.19 + printf("Assigner ended: \t%lu cycles, %lu instrs [Core %d]\n",record->end_assign_cycles,record->end_assign_instrs,record->assigning_core); 2.20 + printf("Work+comm started:\t%lu cycles, %lu instrs [Core %d]\n",record->start_work_cycles,record->start_work_instrs,record->work_core); 2.21 + printf("Work+comm ended:\t%lu cycles, %lu instrs [Core %d]\n",record->suspend_cycles,record->suspend_instrs,record->work_core); 2.22 + printf("Status request read:\t%lu cycles, %lu instrs [Core %d]\n",record->req_cycles,record->req_instrs,record->req_core); 2.23 } 2.24
3.1 --- a/Counters/Counters.h Tue Jul 26 15:36:24 2011 +0200 3.2 +++ b/Counters/Counters.h Tue Aug 02 17:16:12 2011 +0200 3.3 @@ -15,12 +15,15 @@ 3.4 int work_core; 3.5 int assigning_core; 3.6 int req_core; 3.7 + int vp_id; 3.8 + uint32 blocked_timestamp; 3.9 + uint32 unblocked_timestamp; 3.10 uint64 req_cycles; 3.11 uint64 req_instrs; 3.12 uint64 sc_done_cycles; 3.13 uint64 sc_done_instrs; 3.14 - uint64 enter_readyQ_cycles; 3.15 - uint64 enter_readyQ_instrs; 3.16 +// uint64 enter_readyQ_cycles; 3.17 +// uint64 enter_readyQ_instrs; 3.18 uint64 start_assign_cycles; 3.19 uint64 start_assign_instrs; 3.20 uint64 end_assign_cycles;
4.1 --- a/MasterLoop.c Tue Jul 26 15:36:24 2011 +0200 4.2 +++ b/MasterLoop.c Tue Aug 02 17:16:12 2011 +0200 4.3 @@ -147,29 +147,18 @@ 4.4 int32 startStamp1, endStamp1; 4.5 saveLowTimeStampCountInto( startStamp1 ); 4.6 #endif 4.7 - #ifdef MEAS__PERF_COUNTER 4.8 + #ifdef MEAS__PERF_COUNTERS 4.9 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; 4.10 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; 4.11 lastRecord->req_core = thisCoresIdx; 4.12 - int cycles_fd = masterEnv->cycles_counter_fd[thisCoresIdx]; 4.13 - int instrs_fd = masterEnv->instrs_counter_fd[thisCoresIdx]; 4.14 - int nread; 4.15 - 4.16 - nread = read(cycles_fd,&(lastRecord->req_cycles),sizeof(lastRecord->req_cycles)); 4.17 - if(nread<0){ 4.18 - lastRecord->req_cycles = 0; 4.19 - } 4.20 - 4.21 - nread = read(instrs_fd,&(lastRecord->req_instrs),sizeof(lastRecord->req_instrs)); 4.22 - if(nread<0){ 4.23 - lastRecord->req_instrs = 0; 4.24 - } 4.25 + saveCyclesAndInstrs(thisCoresIdx,lastRecord->req_cycles,lastRecord->req_instrs); 4.26 //End of task, start of next task 4.27 //print counters from last run 4.28 print_record(lastRecord); 4.29 - //create new entry in record array here 4.30 + //create new entry in record array 4.31 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); 4.32 newRecord->req_core = thisCoresIdx; 4.33 + newRecord->vp_id = currSlot->procrAssignedToSlot->procrID; 4.34 addToDynArray( (void*) newRecord, currSlot->procrAssignedToSlot->counter_history_array_info); 4.35 lastRecord = newRecord; 4.36 #endif 4.37 @@ -183,65 +172,38 @@ 4.38 addIntervalToHist( startStamp1, endStamp1, 4.39 _VMSMasterEnv->reqHdlrHighTimeHist ); 4.40 #endif 4.41 - #ifdef MEAS__PERF_COUNTER 4.42 - 4.43 - nread = read(cycles_fd,&(lastRecord->sc_done_cycles),sizeof(lastRecord->sc_done_cycles)); 4.44 - if(nread<0){ 4.45 - lastRecord->sc_done_cycles = 0; 4.46 - } 4.47 - nread = read(instrs_fd,&(lastRecord->sc_done_instrs),sizeof(lastRecord->sc_done_instrs)); 4.48 - if(nread<0){ 4.49 - lastRecord->sc_done_instrs = 0; 4.50 - } 4.51 + #ifdef MEAS__PERF_COUNTERS 4.52 + //done with constraints check 4.53 + saveCyclesAndInstrs(thisCoresIdx,lastRecord->sc_done_cycles,lastRecord->sc_done_instrs); 4.54 + saveLowTimeStampCountInto(lastRecord->blocked_timestamp); 4.55 #endif 4.56 //============================================================ 4.57 } 4.58 if( currSlot->needsProcrAssigned ) 4.59 { //give slot a new virt procr 4.60 - #ifdef MEAS__PERF_COUNTER 4.61 + #ifdef MEAS__PERF_COUNTERS 4.62 //start assigner 4.63 - int cycles_fd = masterEnv->cycles_counter_fd[thisCoresIdx]; 4.64 - int instrs_fd = masterEnv->instrs_counter_fd[thisCoresIdx]; 4.65 uint64 tmp_cycles; 4.66 uint64 tmp_instrs; 4.67 - int nread=0; 4.68 - 4.69 - nread = read(cycles_fd,&tmp_cycles,sizeof(uint64)); 4.70 - if(nread<0){ 4.71 - tmp_cycles = 0; 4.72 - } 4.73 - 4.74 - nread = read(instrs_fd,&tmp_instrs,sizeof(uint64)); 4.75 - if(nread<0){ 4.76 - tmp_instrs = 0; 4.77 - } 4.78 + saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); 4.79 #endif 4.80 schedVirtPr = 4.81 (*slaveScheduler)( semanticEnv, thisCoresIdx ); 4.82 - #ifdef MEAS__PERF_COUNTER 4.83 + 4.84 + if( schedVirtPr != NULL ) 4.85 + { currSlot->procrAssignedToSlot = schedVirtPr; 4.86 + schedVirtPr->schedSlot = currSlot; 4.87 + currSlot->needsProcrAssigned = FALSE; 4.88 + numSlotsFilled += 1; 4.89 + #ifdef MEAS__PERF_COUNTERS 4.90 //end assigner 4.91 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; 4.92 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; 4.93 lastRecord->assigning_core = thisCoresIdx; 4.94 lastRecord->start_assign_cycles = tmp_cycles; 4.95 lastRecord->start_assign_instrs = tmp_instrs; 4.96 - 4.97 - nread = read(cycles_fd,&(lastRecord->end_assign_cycles),sizeof(lastRecord->end_assign_cycles)); 4.98 - if(nread<0){ 4.99 - lastRecord->end_assign_cycles = 0; 4.100 - } 4.101 - 4.102 - nread = read(instrs_fd,&(lastRecord->end_assign_instrs),sizeof(lastRecord->end_assign_instrs)); 4.103 - if(nread<0){ 4.104 - lastRecord->end_assign_instrs = 0; 4.105 - } 4.106 + saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); 4.107 #endif 4.108 - if( schedVirtPr != NULL ) 4.109 - { currSlot->procrAssignedToSlot = schedVirtPr; 4.110 - schedVirtPr->schedSlot = currSlot; 4.111 - currSlot->needsProcrAssigned = FALSE; 4.112 - numSlotsFilled += 1; 4.113 - 4.114 writeVMSQ( schedVirtPr, readyToAnimateQ ); 4.115 } 4.116 }
5.1 --- a/ProcrContext.c Tue Jul 26 15:36:24 2011 +0200 5.2 +++ b/ProcrContext.c Tue Aug 02 17:16:12 2011 +0200 5.3 @@ -59,7 +59,12 @@ 5.4 //newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0) - 5.5 // _VMSMasterEnv->createPtInSecs; 5.6 #endif 5.7 - 5.8 + #ifdef MEAS__PERF_COUNTERS 5.9 + newPr->counter_history = VMS__malloc(10*sizeof(void*)); 5.10 + newPr->counter_history_array_info = makePrivDynArrayInfoFrom(&(newPr->counter_history),10); 5.11 + CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); 5.12 + addToDynArray( (void*) newRecord, newPr->counter_history_array_info); 5.13 + #endif 5.14 //======================================================================== 5.15 5.16 return newPr;
6.1 --- a/VMS.c Tue Jul 26 15:36:24 2011 +0200 6.2 +++ b/VMS.c Tue Aug 02 17:16:12 2011 +0200 6.3 @@ -16,9 +16,14 @@ 6.4 #include "Queue_impl/BlockingQueue.h" 6.5 #include "Histogram/Histogram.h" 6.6 6.7 +#include <unistd.h> 6.8 +#include <fcntl.h> 6.9 +#include <linux/types.h> 6.10 #include <linux/perf_event.h> 6.11 -#include <syscall.h> 6.12 -#include <sys/prctl.h> 6.13 +#include <errno.h> 6.14 +#include <sys/syscall.h> 6.15 +#include <linux/prctl.h> 6.16 + 6.17 6.18 #define thdAttrs NULL 6.19 6.20 @@ -181,12 +186,14 @@ 6.21 6.22 MakeTheMeasHists(); 6.23 6.24 - #ifdef MEAS__PERF_COUNTER 6.25 + #ifdef MEAS__PERF_COUNTERS 6.26 printf("Creating HW counters..."); 6.27 struct perf_event_attr hw_event; 6.28 + memset(&hw_event,0,sizeof(hw_event)); 6.29 hw_event.type = PERF_TYPE_HARDWARE; 6.30 - hw_event.size = sizeof(struct perf_event_attr); 6.31 + hw_event.size = sizeof(hw_event); 6.32 hw_event.disabled = 1; 6.33 + hw_event.freq = 0; 6.34 hw_event.inherit = 1; /* children inherit it */ 6.35 hw_event.pinned = 1; /* must always be on PMU */ 6.36 hw_event.exclusive = 0; /* only group on PMU */ 6.37 @@ -197,24 +204,36 @@ 6.38 hw_event.mmap = 0; /* include mmap data */ 6.39 hw_event.comm = 0; /* include comm data */ 6.40 6.41 + 6.42 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 6.43 { 6.44 - hw_event.config = PERF_COUNT_HW_CPU_CYCLES; //cycles 6.45 + hw_event.config = 0x0000000000000000; //cycles 6.46 _VMSMasterEnv->cycles_counter_fd[coreIdx] = syscall(__NR_perf_event_open, &hw_event, 6.47 0,//pid_t pid, 6.48 - coreIdx,//int cpu, 6.49 + -1,//int cpu, 6.50 -1,//int group_fd, 6.51 0//unsigned long flags 6.52 ); 6.53 - hw_event.config = PERF_COUNT_HW_INSTRUCTIONS; //instrs 6.54 + if (_VMSMasterEnv->cycles_counter_fd[coreIdx]<0){ 6.55 + fprintf(stderr,"On core %d: ",coreIdx); 6.56 + perror("Failed to open cycles counter"); 6.57 + } 6.58 + hw_event.config = 0x0000000000000001; //instrs 6.59 _VMSMasterEnv->instrs_counter_fd[coreIdx] = syscall(__NR_perf_event_open, &hw_event, 6.60 0,//pid_t pid, 6.61 - coreIdx,//int cpu, 6.62 + -1,//int cpu, 6.63 -1,//int group_fd, 6.64 0//unsigned long flags 6.65 ); 6.66 + if (_VMSMasterEnv->instrs_counter_fd[coreIdx]<0){ 6.67 + fprintf(stderr,"On core %d: ",coreIdx); 6.68 + perror("Failed to open instrs counter"); 6.69 + } 6.70 } 6.71 prctl(PR_TASK_PERF_EVENTS_ENABLE); 6.72 + uint64 tmpc,tmpi; 6.73 + saveCyclesAndInstrs(0,tmpc,tmpi); 6.74 + printf("Start: cycles = %lu, instrs = %lu\n",tmpc,tmpi); 6.75 #endif 6.76 6.77 //======================================================================== 6.78 @@ -419,7 +438,8 @@ 6.79 * to the plugin. 6.80 */ 6.81 void 6.82 -VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr ) 6.83 +VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr ) __attribute__ ((noinline)) 6.84 + 6.85 { VMSReqst req; 6.86 6.87 req.reqType = createReq; 6.88 @@ -453,7 +473,7 @@ 6.89 * pears -- making that suspend the last thing in the virt procr's trace. 6.90 */ 6.91 void 6.92 -VMS__send_dissipate_req( VirtProcr *procrToDissipate ) 6.93 +VMS__send_dissipate_req( VirtProcr *procrToDissipate ) __attribute__ ((noinline)) 6.94 { VMSReqst req; 6.95 6.96 req.reqType = dissipate; 6.97 @@ -512,8 +532,8 @@ 6.98 * to plugin 6.99 *Then it does suspend, to cause request to be sent. 6.100 */ 6.101 -inline void 6.102 -VMS__send_sem_request( void *semReqData, VirtProcr *callingPr ) 6.103 +/*inline*/ void 6.104 +VMS__send_sem_request( void *semReqData, VirtProcr *callingPr ) __attribute__ ((noinline)) 6.105 { VMSReqst req; 6.106 6.107 req.reqType = semantic; 6.108 @@ -525,8 +545,9 @@ 6.109 } 6.110 6.111 6.112 -inline void 6.113 -VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ) 6.114 +/*inline*/ void 6.115 +VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ) __attribute__ ((noinline)) 6.116 + 6.117 { VMSReqst req; 6.118 6.119 req.reqType = VMSSemantic; 6.120 @@ -678,7 +699,18 @@ 6.121 shutDownPr = VMS__create_procr( &endOSThreadFn, NULL ); 6.122 writeVMSQ( shutDownPr, _VMSMasterEnv->readyToAnimateQs[coreIdx] ); 6.123 } 6.124 - 6.125 +#ifdef MEAS__PERF_COUNTERS 6.126 + uint64 tmpc,tmpi; 6.127 + saveCyclesAndInstrs(0,tmpc,tmpi); 6.128 + printf("End: cycles = %lu, instrs = %lu\n",tmpc,tmpi); 6.129 + prctl(PR_TASK_PERF_EVENTS_DISABLE); 6.130 +/* 6.131 + for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ){ 6.132 + close(_VMSMasterEnv->cycles_counter_fd[coreIdx]); 6.133 + close(_VMSMasterEnv->instrs_counter_fd[coreIdx]); 6.134 + } 6.135 +*/ 6.136 +#endif 6.137 } 6.138 6.139 6.140 @@ -718,8 +750,8 @@ 6.141 //SchedSlot ***allSchedSlots; //ptr to array of ptrs 6.142 6.143 //Before getting rid of everything, print out any measurements made 6.144 - forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&printHist ); 6.145 - forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile); 6.146 + //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&printHist ); 6.147 + //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile); 6.148 //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt ); 6.149 #ifdef MEAS__TIME_PLUGIN 6.150 printHist( _VMSMasterEnv->reqHdlrLowTimeHist );
7.1 --- a/VMS.h Tue Jul 26 15:36:24 2011 +0200 7.2 +++ b/VMS.h Tue Aug 02 17:16:12 2011 +0200 7.3 @@ -45,11 +45,11 @@ 7.4 7.5 //Comment or un- the substitute half to turn on/off types of debug message 7.6 #define DEBUG( bool, msg) \ 7.7 -// if( bool){ printf(msg); fflush(stdin);} 7.8 + if( bool){ printf(msg); fflush(stdin);} 7.9 #define DEBUG1( bool, msg, param) \ 7.10 -// if(bool){printf(msg, param); fflush(stdin);} 7.11 + if(bool){printf(msg, param); fflush(stdin);} 7.12 #define DEBUG2( bool, msg, p1, p2) \ 7.13 -// if(bool) {printf(msg, p1, p2); fflush(stdin);} 7.14 + if(bool) {printf(msg, p1, p2); fflush(stdin);} 7.15 7.16 #define ERROR(msg) printf(msg); 7.17 #define ERROR1(msg, param) printf(msg, param); 7.18 @@ -64,14 +64,14 @@ 7.19 // rollover of low portion into high portion. 7.20 //#define MEAS__TIME_STAMP_SUSP 7.21 //#define MEAS__TIME_MASTER 7.22 -#define MEAS__TIME_PLUGIN 7.23 -#define MEAS__TIME_MALLOC 7.24 +//#define MEAS__TIME_PLUGIN 7.25 +//#define MEAS__TIME_MALLOC 7.26 //#define MEAS__TIME_MASTER_LOCK 7.27 -#define MEAS__NUM_TIMES_TO_RUN 100000 7.28 +//#define MEAS__NUM_TIMES_TO_RUN 100000 7.29 7.30 //For code that calculates normalization-offset between TSC counts of 7.31 // different cores. 7.32 -#define NUM_TSC_ROUND_TRIPS 10 7.33 +//#define NUM_TSC_ROUND_TRIPS 10 7.34 7.35 #define MEAS__PERF_COUNTERS 7.36 7.37 @@ -415,6 +415,24 @@ 7.38 _VMSMasterEnv->measHists[idx] = \ 7.39 makeFixedBinHist( numBins, startVal, binWidth, name ); 7.40 7.41 +#define saveCyclesAndInstrs(core,cycles,instrs) do{ \ 7.42 + int cycles_fd = _VMSMasterEnv->cycles_counter_fd[core]; \ 7.43 + int instrs_fd = _VMSMasterEnv->instrs_counter_fd[core]; \ 7.44 + int nread; \ 7.45 + \ 7.46 + nread = read(cycles_fd,&(cycles),sizeof(cycles)); \ 7.47 + if(nread<0){ \ 7.48 + perror("Error reading cycles counter"); \ 7.49 + cycles = 0; \ 7.50 + } \ 7.51 + \ 7.52 + nread = read(instrs_fd,&(instrs),sizeof(instrs)); \ 7.53 + if(nread<0){ \ 7.54 + perror("Error reading cycles counter"); \ 7.55 + instrs = 0; \ 7.56 + } \ 7.57 +} while (0) 7.58 + 7.59 7.60 #define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/ 7.61
