Lines Matching refs:attr
45 OHOS::UniqueFd PerfEvents::Open(perf_event_attr &attr, pid_t pid, int cpu, int group_fd, in Open() argument
48 OHOS::UniqueFd fd = UniqueFd(syscall(__NR_perf_event_open, &attr, pid, cpu, group_fd, flags)); in Open()
52 SubCommandDump::DumpPrintEventAttr(attr, std::numeric_limits<int>::min()); in Open()
88 unique_ptr<perf_event_attr> attr = PerfEvents::CreateDefaultAttr(type, config); in IsEventSupport() local
89 UniqueFd fd = Open(*attr.get()); in IsEventSupport()
98 bool PerfEvents::IsEventAttrSupport(perf_event_attr &attr) in IsEventAttrSupport() argument
100 UniqueFd fd = Open(attr); in IsEventAttrSupport()
113 unique_ptr<perf_event_attr> attr = in SetBranchSampleType() local
115 attr->sample_type |= PERF_SAMPLE_BRANCH_STACK; in SetBranchSampleType()
116 attr->branch_sample_type = value; in SetBranchSampleType()
117 if (!IsEventAttrSupport(*attr.get())) { in SetBranchSampleType()
295 if (memset_s(&eventItem.attr, sizeof(perf_event_attr), 0, sizeof(perf_event_attr)) != EOK) { in AddEvent()
299 eventItem.attr.size = sizeof(perf_event_attr); in AddEvent()
300 eventItem.attr.type = type; in AddEvent()
301 eventItem.attr.config = config; in AddEvent()
302 eventItem.attr.disabled = 1; in AddEvent()
303 eventItem.attr.read_format = in AddEvent()
306 eventItem.attr.inherit = (inherit_ ? 1 : 0); in AddEvent()
307 eventItem.attr.exclude_kernel = excludeKernel; in AddEvent()
308 eventItem.attr.exclude_user = excludeUser; in AddEvent()
313 eventItem.attr.freq = 0; in AddEvent()
314 eventItem.attr.sample_freq = 0; in AddEvent()
315 eventItem.attr.sample_period = samplePeriod_; in AddEvent()
317 eventItem.attr.freq = 1; in AddEvent()
318 eventItem.attr.sample_freq = sampleFreq_; in AddEvent()
321 eventItem.attr.freq = 0; in AddEvent()
322 eventItem.attr.sample_period = DEFAULT_SAMPLE_PERIOD; in AddEvent()
324 eventItem.attr.freq = 1; in AddEvent()
325 eventItem.attr.sample_freq = DEFAULT_SAMPLE_FREQUNCY; in AddEvent()
329 eventItem.attr.watermark = 1; in AddEvent()
330 if (eventItem.attr.watermark == 1) { in AddEvent()
331 eventItem.attr.wakeup_watermark = (mmapPages_ * pageSize_) >> 1; in AddEvent()
333 if (eventItem.attr.wakeup_watermark > maxWakeupMark) { in AddEvent()
334 eventItem.attr.wakeup_watermark = maxWakeupMark; in AddEvent()
340 eventItem.attr.comm = 1; in AddEvent()
341 eventItem.attr.mmap = 1; in AddEvent()
342 eventItem.attr.mmap2 = 1; in AddEvent()
343 eventItem.attr.mmap_data = 0; in AddEvent()
347 eventItem.attr.sample_type = SAMPLE_TYPE | PERF_SAMPLE_CALLCHAIN | in AddEvent()
349 eventItem.attr.exclude_callchain_user = 1; in AddEvent()
350 eventItem.attr.sample_regs_user = GetSupportedRegMask(GetDeviceArch()); in AddEvent()
351 eventItem.attr.sample_stack_user = dwarfSampleStackSize_; in AddEvent()
353 eventItem.attr.sample_type = SAMPLE_TYPE | PERF_SAMPLE_CALLCHAIN; in AddEvent()
355 eventItem.attr.sample_type = SAMPLE_TYPE; in AddEvent()
361 eventItem.attr.use_clockid = 1; in AddEvent()
362 eventItem.attr.clockid = clockId_; in AddEvent()
365 eventItem.attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; in AddEvent()
366 eventItem.attr.branch_sample_type = branchSampleType_; in AddEvent()
378 unique_ptr<perf_event_attr> attr = make_unique<perf_event_attr>(); in CreateDefaultAttr() local
379 if (memset_s(attr.get(), sizeof(perf_event_attr), 0, sizeof(perf_event_attr)) != EOK) { in CreateDefaultAttr()
383 attr->size = sizeof(perf_event_attr); in CreateDefaultAttr()
384 attr->type = type; in CreateDefaultAttr()
385 attr->config = config; in CreateDefaultAttr()
386 attr->disabled = 1; in CreateDefaultAttr()
387 return attr; in CreateDefaultAttr()
935 UniqueFd fd = Open(eventItem.attr, pids_[ipid], cpus_[icpu], in CreateFdEvents()
971 CreateMmap(fdItem, eventItem.attr); in CreateFdEvents()
1010 if (eventItem.attr.exclude_kernel) { in StatReport()
1012 } else if (eventItem.attr.exclude_user) { in StatReport()
1020 countEvents_[configName]->userOnly = eventItem.attr.exclude_kernel; in StatReport()
1021 countEvents_[configName]->kernelOnly = eventItem.attr.exclude_user; in StatReport()
1055 bool PerfEvents::CreateMmap(const FdItem &item, const perf_event_attr &attr) in CreateMmap() argument
1073 mmapItem.attr = &attr; in CreateMmap()
1074 mmapItem.posCallChain = GetCallChainPosInSampleRecord(attr); in CreateMmap()
1100 attrId.attr = eventItem.attr; in GetAttrWithId()
1241 size_t PerfEvents::GetCallChainPosInSampleRecord(const perf_event_attr &attr) in GetCallChainPosInSampleRecord() argument
1245 attr.sample_type & (PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_IP | PERF_SAMPLE_TID | in GetCallChainPosInSampleRecord()
1249 if (attr.sample_type & PERF_SAMPLE_READ) { in GetCallChainPosInSampleRecord()
1258 if (mmap.attr->sample_type & PERF_SAMPLE_CALLCHAIN) { in GetStackSizePosInSampleRecord()
1263 if (mmap.attr->sample_type & PERF_SAMPLE_RAW) { in GetStackSizePosInSampleRecord()
1268 if (mmap.attr->sample_type & PERF_SAMPLE_BRANCH_STACK) { in GetStackSizePosInSampleRecord()
1273 if (mmap.attr->sample_type & PERF_SAMPLE_REGS_USER) { in GetStackSizePosInSampleRecord()
1278 uint64_t reg_nr = __builtin_popcountll(mmap.attr->sample_regs_user); in GetStackSizePosInSampleRecord()
1288 if (!(mmap.attr->sample_type & PERF_SAMPLE_STACK_USER)) { in CutStackAndMove()
1379 const perf_event_attr *attr = GetDefaultAttr(); in ReadRecordFromBuf() local
1399 recordCallBack_(GetPerfEventRecord(*type, p, *attr)); in ReadRecordFromBuf()
1418 recordCallBack_(GetPerfEventRecord(*type, p, *attr)); in ReadRecordFromBuf()