Lines Matching refs:attr

47 OHOS::UniqueFd PerfEvents::Open(perf_event_attr &attr, pid_t pid, int cpu, int groupFd,
50 OHOS::UniqueFd fd = UniqueFd(syscall(__NR_perf_event_open, &attr, pid, cpu, groupFd, flags));
54 SubCommandDump::DumpPrintEventAttr(attr, std::numeric_limits<int>::min());
192 unique_ptr<perf_event_attr> attr = PerfEvents::CreateDefaultAttr(type, config);
193 CHECK_TRUE(attr == nullptr, false, 0, "");
194 UniqueFd fd = Open(*attr.get());
201 bool PerfEvents::IsEventAttrSupport(perf_event_attr &attr)
203 UniqueFd fd = Open(attr);
214 unique_ptr<perf_event_attr> attr =
216 CHECK_TRUE(attr == nullptr, false, 0, "");
217 attr->sample_type |= PERF_SAMPLE_BRANCH_STACK;
218 attr->branch_sample_type = value;
219 if (!IsEventAttrSupport(*attr.get())) {
380 if (memset_s(&eventItem.attr, sizeof(perf_event_attr), 0, sizeof(perf_event_attr)) != EOK) {
384 eventItem.attr.type = type;
385 eventItem.attr.sample_period = MULTIPLE_SIZE;
386 eventItem.attr.size = sizeof(perf_event_attr);
387 eventItem.attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING | PERF_FORMAT_ID;
388 eventItem.attr.inherit = (inherit_ ? 1 : 0);
389 eventItem.attr.sample_type = SAMPLE_ID;
390 eventItem.attr.sample_id_all = 1;
391 eventItem.attr.disabled = 1;
392 eventItem.attr.config = 0x700010007; // temp type
435 // attr
436 if (memset_s(&eventItem.attr, sizeof(perf_event_attr), 0, sizeof(perf_event_attr)) != EOK) {
440 eventItem.attr.size = sizeof(perf_event_attr);
441 eventItem.attr.type = type;
442 eventItem.attr.config = config;
443 eventItem.attr.disabled = 1;
444 eventItem.attr.read_format =
447 eventItem.attr.inherit = (inherit_ ? 1 : 0);
448 eventItem.attr.exclude_kernel = excludeKernel;
449 eventItem.attr.exclude_user = excludeUser;
454 eventItem.attr.freq = 0;
455 eventItem.attr.sample_freq = 0;
456 eventItem.attr.sample_period = samplePeriod_;
458 eventItem.attr.freq = 1;
459 eventItem.attr.sample_freq = sampleFreq_;
462 eventItem.attr.freq = 0;
463 eventItem.attr.sample_period = DEFAULT_SAMPLE_PERIOD;
465 eventItem.attr.freq = 1;
466 eventItem.attr.sample_freq = DEFAULT_SAMPLE_FREQUNCY;
470 eventItem.attr.watermark = 1;
471 eventItem.attr.wakeup_watermark = (mmapPages_ * pageSize_) >> 1;
473 if (eventItem.attr.wakeup_watermark > maxWakeupMark) {
474 eventItem.attr.wakeup_watermark = maxWakeupMark;
479 eventItem.attr.comm = 1;
480 eventItem.attr.mmap = 1;
481 eventItem.attr.mmap2 = 1;
482 eventItem.attr.mmap_data = 1;
486 eventItem.attr.sample_type = SAMPLE_TYPE | PERF_SAMPLE_CALLCHAIN |
488 eventItem.attr.exclude_callchain_user = 1;
489 eventItem.attr.sample_regs_user = GetSupportedRegMask(GetDeviceArch());
490 eventItem.attr.sample_stack_user = dwarfSampleStackSize_;
492 eventItem.attr.sample_type = SAMPLE_TYPE | PERF_SAMPLE_CALLCHAIN;
494 eventItem.attr.sample_type = SAMPLE_TYPE;
498 eventItem.attr.sample_type |= PERF_SAMPLE_SERVER_PID;
504 eventItem.attr.use_clockid = 1;
505 eventItem.attr.clockid = clockId_;
508 eventItem.attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
509 eventItem.attr.branch_sample_type = branchSampleType_;
521 unique_ptr<perf_event_attr> attr = make_unique<perf_event_attr>();
522 if (memset_s(attr.get(), sizeof(perf_event_attr), 0, sizeof(perf_event_attr)) != EOK) {
526 attr->size = sizeof(perf_event_attr);
527 attr->type = type;
528 attr->config = config;
529 attr->disabled = 1;
530 return attr;
1085 UniqueFd fd = Open(eventItem.attr, pids_[ipid], cpus_[icpu],
1123 CreateSpeMmap(fdItem, eventItem.attr) : CreateMmap(fdItem, eventItem.attr);
1164 if (eventItem.attr.exclude_kernel) {
1166 } else if (eventItem.attr.exclude_user) {
1174 countEvents_[configName]->userOnly = eventItem.attr.exclude_kernel;
1175 countEvents_[configName]->kernelOnly = eventItem.attr.exclude_user;
1209 bool PerfEvents::CreateSpeMmap(const FdItem &item, const perf_event_attr &attr)
1225 mmapItem.attr = &attr;
1242 bool PerfEvents::CreateMmap(const FdItem &item, const perf_event_attr &attr)
1260 mmapItem.attr = &attr;
1261 mmapItem.posCallChain = GetCallChainPosInSampleRecord(attr);
1287 attrId.attr = eventItem.attr;
1453 size_t PerfEvents::GetCallChainPosInSampleRecord(const perf_event_attr &attr)
1457 attr.sample_type & (PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_IP | PERF_SAMPLE_TID |
1461 if (attr.sample_type & PERF_SAMPLE_READ) {
1470 if (mmap.attr->sample_type & PERF_SAMPLE_CALLCHAIN) {
1475 if (mmap.attr->sample_type & PERF_SAMPLE_RAW) {
1480 if (mmap.attr->sample_type & PERF_SAMPLE_BRANCH_STACK) {
1485 if (mmap.attr->sample_type & PERF_SAMPLE_REGS_USER) {
1490 uint64_t reg_nr = __builtin_popcountll(mmap.attr->sample_regs_user);
1494 if (mmap.attr->sample_type & PERF_SAMPLE_SERVER_PID) {
1505 if (!(mmap.attr->sample_type & PERF_SAMPLE_STACK_USER)) {
1607 const perf_event_attr *attr = GetDefaultAttr();
1627 recordCallBack_(GetPerfSampleFromCache(*type, p, *attr));
1646 recordCallBack_(GetPerfSampleFromCache(*type, p, *attr));