Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.c @ 108:3bc3b89630c7
perf counters
| author | engelhardt@cray1 |
|---|---|
| date | Tue, 26 Jul 2011 15:36:24 +0200 |
| parents | 97e26095c01f |
| children | 659299627e70 |
comparison
equal
deleted
inserted
replaced
| 43:ccd9e7a56902 | 49:626b11cad78c |
|---|---|
| 14 #include "VMS.h" | 14 #include "VMS.h" |
| 15 #include "ProcrContext.h" | 15 #include "ProcrContext.h" |
| 16 #include "Queue_impl/BlockingQueue.h" | 16 #include "Queue_impl/BlockingQueue.h" |
| 17 #include "Histogram/Histogram.h" | 17 #include "Histogram/Histogram.h" |
| 18 | 18 |
| 19 #include <linux/perf_event.h> | |
| 20 #include <syscall.h> | |
| 21 #include <sys/prctl.h> | |
| 19 | 22 |
| 20 #define thdAttrs NULL | 23 #define thdAttrs NULL |
| 21 | 24 |
| 22 //=========================================================================== | 25 //=========================================================================== |
| 23 void | 26 void |
| 175 _VMSMasterEnv->masterLockHighTimeHist = makeFixedBinHist( 50, 0, 100, | 178 _VMSMasterEnv->masterLockHighTimeHist = makeFixedBinHist( 50, 0, 100, |
| 176 "master lock high time hist"); | 179 "master lock high time hist"); |
| 177 #endif | 180 #endif |
| 178 | 181 |
| 179 MakeTheMeasHists(); | 182 MakeTheMeasHists(); |
| 183 | |
| 184 #ifdef MEAS__PERF_COUNTER | |
| 185 printf("Creating HW counters..."); | |
| 186 struct perf_event_attr hw_event; | |
| 187 hw_event.type = PERF_TYPE_HARDWARE; | |
| 188 hw_event.size = sizeof(struct perf_event_attr); | |
| 189 hw_event.disabled = 1; | |
| 190 hw_event.inherit = 1; /* children inherit it */ | |
| 191 hw_event.pinned = 1; /* must always be on PMU */ | |
| 192 hw_event.exclusive = 0; /* only group on PMU */ | |
| 193 hw_event.exclude_user = 0; /* don't count user */ | |
| 194 hw_event.exclude_kernel = 1; /* ditto kernel */ | |
| 195 hw_event.exclude_hv = 1; /* ditto hypervisor */ | |
| 196 hw_event.exclude_idle = 0; /* don't count when idle */ | |
| 197 hw_event.mmap = 0; /* include mmap data */ | |
| 198 hw_event.comm = 0; /* include comm data */ | |
| 199 | |
| 200 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) | |
| 201 { | |
| 202 hw_event.config = PERF_COUNT_HW_CPU_CYCLES; //cycles | |
| 203 _VMSMasterEnv->cycles_counter_fd[coreIdx] = syscall(__NR_perf_event_open, &hw_event, | |
| 204 0,//pid_t pid, | |
| 205 coreIdx,//int cpu, | |
| 206 -1,//int group_fd, | |
| 207 0//unsigned long flags | |
| 208 ); | |
| 209 hw_event.config = PERF_COUNT_HW_INSTRUCTIONS; //instrs | |
| 210 _VMSMasterEnv->instrs_counter_fd[coreIdx] = syscall(__NR_perf_event_open, &hw_event, | |
| 211 0,//pid_t pid, | |
| 212 coreIdx,//int cpu, | |
| 213 -1,//int group_fd, | |
| 214 0//unsigned long flags | |
| 215 ); | |
| 216 } | |
| 217 prctl(PR_TASK_PERF_EVENTS_ENABLE); | |
| 218 #endif | |
| 219 | |
| 180 //======================================================================== | 220 //======================================================================== |
| 181 | 221 |
| 182 } | 222 } |
| 183 | 223 |
| 184 SchedSlot ** | 224 SchedSlot ** |
