• Home
  • Raw
  • Download

Lines Matching refs:run

56 __attribute__((hot)) static inline void arch_perfBtsCount(run_t* run) {  in arch_perfBtsCount()  argument
57 struct perf_event_mmap_page* pem = (struct perf_event_mmap_page*)run->linux.perfMmapBuf; in arch_perfBtsCount()
65 struct bts_branch* br = (struct bts_branch*)run->linux.perfMmapAux; in arch_perfBtsCount()
66 for (; br < ((struct bts_branch*)(run->linux.perfMmapAux + aux_head)); br++) { in arch_perfBtsCount()
71 if (run->global->linux.kernelOnly == false && in arch_perfBtsCount()
77 if (br->from >= run->global->linux.dynamicCutOffAddr || in arch_perfBtsCount()
78 br->to >= run->global->linux.dynamicCutOffAddr) { in arch_perfBtsCount()
84 register uint8_t prev = ATOMIC_BTS(run->global->feedback.feedbackMap->bbMapPc, pos); in arch_perfBtsCount()
86 run->linux.hwCnts.newBBCnt++; in arch_perfBtsCount()
92 static inline void arch_perfMmapParse(run_t* run HF_ATTR_UNUSED) { in arch_perfMmapParse()
94 struct perf_event_mmap_page* pem = (struct perf_event_mmap_page*)run->linux.perfMmapBuf; in arch_perfMmapParse()
101 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BTS_EDGE) { in arch_perfMmapParse()
102 arch_perfBtsCount(run); in arch_perfMmapParse()
104 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_IPT_BLOCK) { in arch_perfMmapParse()
105 arch_ptAnalyze(run); in arch_perfMmapParse()
116 static bool arch_perfCreate(run_t* run, pid_t pid, dynFileMethod_t method, int* perfFd) { in arch_perfCreate() argument
133 if (run->global->linux.kernelOnly) { in arch_perfCreate()
139 if (!run->global->exe.persistent) { in arch_perfCreate()
184 if ((run->linux.perfMmapBuf = mmap(NULL, _HF_PERF_MAP_SZ + getpagesize(), in arch_perfCreate()
186 run->linux.perfMmapBuf = NULL; in arch_perfCreate()
195 struct perf_event_mmap_page* pem = (struct perf_event_mmap_page*)run->linux.perfMmapBuf; in arch_perfCreate()
198 if ((run->linux.perfMmapAux = mmap( in arch_perfCreate()
200 munmap(run->linux.perfMmapBuf, _HF_PERF_MAP_SZ + getpagesize()); in arch_perfCreate()
201 run->linux.perfMmapBuf = NULL; in arch_perfCreate()
216 bool arch_perfOpen(run_t* run) { in arch_perfOpen() argument
217 if (run->global->feedback.dynFileMethod == _HF_DYNFILE_NONE) { in arch_perfOpen()
221 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_INSTR_COUNT) { in arch_perfOpen()
222 if (!arch_perfCreate(run, run->pid, _HF_DYNFILE_INSTR_COUNT, &run->linux.cpuInstrFd)) { in arch_perfOpen()
223 LOG_E("Cannot set up perf for pid=%d (_HF_DYNFILE_INSTR_COUNT)", (int)run->pid); in arch_perfOpen()
227 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BRANCH_COUNT) { in arch_perfOpen()
228 if (!arch_perfCreate(run, run->pid, _HF_DYNFILE_BRANCH_COUNT, &run->linux.cpuBranchFd)) { in arch_perfOpen()
229 LOG_E("Cannot set up perf for pid=%d (_HF_DYNFILE_BRANCH_COUNT)", (int)run->pid); in arch_perfOpen()
233 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BTS_EDGE) { in arch_perfOpen()
234 if (!arch_perfCreate(run, run->pid, _HF_DYNFILE_BTS_EDGE, &run->linux.cpuIptBtsFd)) { in arch_perfOpen()
235 LOG_E("Cannot set up perf for pid=%d (_HF_DYNFILE_BTS_EDGE)", (int)run->pid); in arch_perfOpen()
239 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_IPT_BLOCK) { in arch_perfOpen()
240 if (!arch_perfCreate(run, run->pid, _HF_DYNFILE_IPT_BLOCK, &run->linux.cpuIptBtsFd)) { in arch_perfOpen()
241 LOG_E("Cannot set up perf for pid=%d (_HF_DYNFILE_IPT_BLOCK)", (int)run->pid); in arch_perfOpen()
249 close(run->linux.cpuInstrFd); in arch_perfOpen()
250 run->linux.cpuInstrFd = -1; in arch_perfOpen()
251 close(run->linux.cpuBranchFd); in arch_perfOpen()
252 run->linux.cpuBranchFd = -1; in arch_perfOpen()
253 close(run->linux.cpuIptBtsFd); in arch_perfOpen()
254 run->linux.cpuIptBtsFd = 1; in arch_perfOpen()
259 void arch_perfClose(run_t* run) { in arch_perfClose() argument
260 if (run->global->feedback.dynFileMethod == _HF_DYNFILE_NONE) { in arch_perfClose()
264 if (run->linux.perfMmapAux != NULL) { in arch_perfClose()
265 munmap(run->linux.perfMmapAux, _HF_PERF_AUX_SZ); in arch_perfClose()
266 run->linux.perfMmapAux = NULL; in arch_perfClose()
268 if (run->linux.perfMmapBuf != NULL) { in arch_perfClose()
269 munmap(run->linux.perfMmapBuf, _HF_PERF_MAP_SZ + getpagesize()); in arch_perfClose()
270 run->linux.perfMmapBuf = NULL; in arch_perfClose()
273 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_INSTR_COUNT) { in arch_perfClose()
274 close(run->linux.cpuInstrFd); in arch_perfClose()
275 run->linux.cpuInstrFd = -1; in arch_perfClose()
277 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BRANCH_COUNT) { in arch_perfClose()
278 close(run->linux.cpuBranchFd); in arch_perfClose()
279 run->linux.cpuBranchFd = -1; in arch_perfClose()
281 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BTS_EDGE) { in arch_perfClose()
282 close(run->linux.cpuIptBtsFd); in arch_perfClose()
283 run->linux.cpuIptBtsFd = -1; in arch_perfClose()
285 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_IPT_BLOCK) { in arch_perfClose()
286 close(run->linux.cpuIptBtsFd); in arch_perfClose()
287 run->linux.cpuIptBtsFd = -1; in arch_perfClose()
291 bool arch_perfEnable(run_t* run) { in arch_perfEnable() argument
292 if (run->global->feedback.dynFileMethod == _HF_DYNFILE_NONE) { in arch_perfEnable()
296 if (!run->global->exe.persistent) { in arch_perfEnable()
300 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_INSTR_COUNT) { in arch_perfEnable()
301 ioctl(run->linux.cpuInstrFd, PERF_EVENT_IOC_ENABLE, 0); in arch_perfEnable()
303 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BRANCH_COUNT) { in arch_perfEnable()
304 ioctl(run->linux.cpuBranchFd, PERF_EVENT_IOC_ENABLE, 0); in arch_perfEnable()
306 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_BTS_EDGE) { in arch_perfEnable()
307 ioctl(run->linux.cpuIptBtsFd, PERF_EVENT_IOC_ENABLE, 0); in arch_perfEnable()
309 if (run->global->feedback.dynFileMethod & _HF_DYNFILE_IPT_BLOCK) { in arch_perfEnable()
310 ioctl(run->linux.cpuIptBtsFd, PERF_EVENT_IOC_ENABLE, 0); in arch_perfEnable()
316 static void arch_perfMmapReset(run_t* run) { in arch_perfMmapReset() argument
320 struct perf_event_mmap_page* pem = (struct perf_event_mmap_page*)run->linux.perfMmapBuf; in arch_perfMmapReset()
329 void arch_perfAnalyze(run_t* run) { in arch_perfAnalyze() argument
330 if (run->global->feedback.dynFileMethod == _HF_DYNFILE_NONE) { in arch_perfAnalyze()
335 if ((run->global->feedback.dynFileMethod & _HF_DYNFILE_INSTR_COUNT) && in arch_perfAnalyze()
336 run->linux.cpuInstrFd != -1) { in arch_perfAnalyze()
337 ioctl(run->linux.cpuInstrFd, PERF_EVENT_IOC_DISABLE, 0); in arch_perfAnalyze()
338 if (files_readFromFd(run->linux.cpuInstrFd, (uint8_t*)&instrCount, sizeof(instrCount)) != in arch_perfAnalyze()
340 PLOG_E("read(perfFd='%d') failed", run->linux.cpuInstrFd); in arch_perfAnalyze()
342 ioctl(run->linux.cpuInstrFd, PERF_EVENT_IOC_RESET, 0); in arch_perfAnalyze()
346 if ((run->global->feedback.dynFileMethod & _HF_DYNFILE_BRANCH_COUNT) && in arch_perfAnalyze()
347 run->linux.cpuBranchFd != -1) { in arch_perfAnalyze()
348 ioctl(run->linux.cpuBranchFd, PERF_EVENT_IOC_DISABLE, 0); in arch_perfAnalyze()
349 if (files_readFromFd(run->linux.cpuBranchFd, (uint8_t*)&branchCount, sizeof(branchCount)) != in arch_perfAnalyze()
351 PLOG_E("read(perfFd='%d') failed", run->linux.cpuBranchFd); in arch_perfAnalyze()
353 ioctl(run->linux.cpuBranchFd, PERF_EVENT_IOC_RESET, 0); in arch_perfAnalyze()
356 if ((run->global->feedback.dynFileMethod & _HF_DYNFILE_BTS_EDGE) && in arch_perfAnalyze()
357 run->linux.cpuIptBtsFd != -1) { in arch_perfAnalyze()
358 ioctl(run->linux.cpuIptBtsFd, PERF_EVENT_IOC_DISABLE, 0); in arch_perfAnalyze()
359 arch_perfMmapParse(run); in arch_perfAnalyze()
360 arch_perfMmapReset(run); in arch_perfAnalyze()
361 ioctl(run->linux.cpuIptBtsFd, PERF_EVENT_IOC_RESET, 0); in arch_perfAnalyze()
363 if ((run->global->feedback.dynFileMethod & _HF_DYNFILE_IPT_BLOCK) && in arch_perfAnalyze()
364 run->linux.cpuIptBtsFd != -1) { in arch_perfAnalyze()
365 ioctl(run->linux.cpuIptBtsFd, PERF_EVENT_IOC_DISABLE, 0); in arch_perfAnalyze()
366 arch_perfMmapParse(run); in arch_perfAnalyze()
367 arch_perfMmapReset(run); in arch_perfAnalyze()
368 ioctl(run->linux.cpuIptBtsFd, PERF_EVENT_IOC_RESET, 0); in arch_perfAnalyze()
371 run->linux.hwCnts.cpuInstrCnt = instrCount; in arch_perfAnalyze()
372 run->linux.hwCnts.cpuBranchCnt = branchCount; in arch_perfAnalyze()