Lines Matching refs:ptr
244 struct intel_pt_recording *ptr = in intel_pt_parse_snapshot_options() local
258 ptr->snapshot_size = snapshot_size; in intel_pt_parse_snapshot_options()
299 struct intel_pt_recording *ptr = in intel_pt_info_priv_size() local
301 const char *filter = intel_pt_find_filter(evlist, ptr->intel_pt_pmu); in intel_pt_info_priv_size()
303 ptr->priv_size = (INTEL_PT_AUXTRACE_PRIV_MAX * sizeof(u64)) + in intel_pt_info_priv_size()
305 ptr->priv_size += sizeof(u64); /* Cap Event Trace */ in intel_pt_info_priv_size()
307 return ptr->priv_size; in intel_pt_info_priv_size()
324 struct intel_pt_recording *ptr = in intel_pt_info_fill() local
326 struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu; in intel_pt_info_fill()
339 if (priv_size != ptr->priv_size) in intel_pt_info_fill()
357 filter = intel_pt_find_filter(session->evlist, ptr->intel_pt_pmu); in intel_pt_info_fill()
386 auxtrace_info->priv[INTEL_PT_HAVE_SCHED_SWITCH] = ptr->have_sched_switch; in intel_pt_info_fill()
387 auxtrace_info->priv[INTEL_PT_SNAPSHOT_MODE] = ptr->snapshot_mode; in intel_pt_info_fill()
616 struct intel_pt_recording *ptr = in intel_pt_recording_options() local
618 struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu; in intel_pt_recording_options()
626 ptr->evlist = evlist; in intel_pt_recording_options()
627 ptr->snapshot_mode = opts->auxtrace_snapshot_mode; in intel_pt_recording_options()
799 if (ptr->all_switch_events && !cpu_wide && perf_can_record_cpu_wide()) { in intel_pt_recording_options()
815 ptr->have_sched_switch = 3; in intel_pt_recording_options()
820 ptr->have_sched_switch = 3; in intel_pt_recording_options()
822 ptr->have_sched_switch = 2; in intel_pt_recording_options()
832 ptr->have_sched_switch = 1; in intel_pt_recording_options()
889 if (!ptr->have_sched_switch && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) && in intel_pt_recording_options()
899 struct intel_pt_recording *ptr = in intel_pt_snapshot_start() local
903 evlist__for_each_entry(ptr->evlist, evsel) { in intel_pt_snapshot_start()
904 if (evsel->core.attr.type == ptr->intel_pt_pmu->type) in intel_pt_snapshot_start()
912 struct intel_pt_recording *ptr = in intel_pt_snapshot_finish() local
916 evlist__for_each_entry(ptr->evlist, evsel) { in intel_pt_snapshot_finish()
917 if (evsel->core.attr.type == ptr->intel_pt_pmu->type) in intel_pt_snapshot_finish()
923 static int intel_pt_alloc_snapshot_refs(struct intel_pt_recording *ptr, int idx) in intel_pt_alloc_snapshot_refs() argument
926 int cnt = ptr->snapshot_ref_cnt, new_cnt = cnt * 2; in intel_pt_alloc_snapshot_refs()
939 memcpy(refs, ptr->snapshot_refs, cnt * sz); in intel_pt_alloc_snapshot_refs()
941 ptr->snapshot_refs = refs; in intel_pt_alloc_snapshot_refs()
942 ptr->snapshot_ref_cnt = new_cnt; in intel_pt_alloc_snapshot_refs()
947 static void intel_pt_free_snapshot_refs(struct intel_pt_recording *ptr) in intel_pt_free_snapshot_refs() argument
951 for (i = 0; i < ptr->snapshot_ref_cnt; i++) in intel_pt_free_snapshot_refs()
952 zfree(&ptr->snapshot_refs[i].ref_buf); in intel_pt_free_snapshot_refs()
953 zfree(&ptr->snapshot_refs); in intel_pt_free_snapshot_refs()
958 struct intel_pt_recording *ptr = in intel_pt_recording_free() local
961 intel_pt_free_snapshot_refs(ptr); in intel_pt_recording_free()
962 free(ptr); in intel_pt_recording_free()
965 static int intel_pt_alloc_snapshot_ref(struct intel_pt_recording *ptr, int idx, in intel_pt_alloc_snapshot_ref() argument
968 size_t ref_buf_size = ptr->snapshot_ref_buf_size; in intel_pt_alloc_snapshot_ref()
975 ptr->snapshot_refs[idx].ref_buf = ref_buf; in intel_pt_alloc_snapshot_ref()
976 ptr->snapshot_refs[idx].ref_offset = snapshot_buf_size - ref_buf_size; in intel_pt_alloc_snapshot_ref()
981 static size_t intel_pt_snapshot_ref_buf_size(struct intel_pt_recording *ptr, in intel_pt_snapshot_ref_buf_size() argument
987 if (ptr->snapshot_size <= 64 * 1024) in intel_pt_snapshot_ref_buf_size()
990 psb_period = intel_pt_psb_period(ptr->intel_pt_pmu, ptr->evlist); in intel_pt_snapshot_ref_buf_size()
1000 if (buf_size >= ptr->snapshot_size / 2) in intel_pt_snapshot_ref_buf_size()
1006 static int intel_pt_snapshot_init(struct intel_pt_recording *ptr, in intel_pt_snapshot_init() argument
1009 if (ptr->snapshot_init_done) in intel_pt_snapshot_init()
1012 ptr->snapshot_init_done = true; in intel_pt_snapshot_init()
1014 ptr->snapshot_ref_buf_size = intel_pt_snapshot_ref_buf_size(ptr, in intel_pt_snapshot_init()
1079 static bool intel_pt_wrapped(struct intel_pt_recording *ptr, int idx, in intel_pt_wrapped() argument
1083 struct intel_pt_snapshot_ref *ref = &ptr->snapshot_refs[idx]; in intel_pt_wrapped()
1087 ptr->snapshot_ref_buf_size, mm->len, in intel_pt_wrapped()
1090 intel_pt_copy_ref(ref->ref_buf, ptr->snapshot_ref_buf_size, mm->len, in intel_pt_wrapped()
1117 struct intel_pt_recording *ptr = in intel_pt_find_snapshot() local
1125 err = intel_pt_snapshot_init(ptr, mm->len); in intel_pt_find_snapshot()
1129 if (idx >= ptr->snapshot_ref_cnt) { in intel_pt_find_snapshot()
1130 err = intel_pt_alloc_snapshot_refs(ptr, idx); in intel_pt_find_snapshot()
1135 if (ptr->snapshot_ref_buf_size) { in intel_pt_find_snapshot()
1136 if (!ptr->snapshot_refs[idx].ref_buf) { in intel_pt_find_snapshot()
1137 err = intel_pt_alloc_snapshot_ref(ptr, idx, mm->len); in intel_pt_find_snapshot()
1141 wrapped = intel_pt_wrapped(ptr, idx, mm, data, *head); in intel_pt_find_snapshot()
1143 wrapped = ptr->snapshot_refs[idx].wrapped; in intel_pt_find_snapshot()
1145 ptr->snapshot_refs[idx].wrapped = true; in intel_pt_find_snapshot()
1185 struct intel_pt_recording *ptr = data; in intel_pt_perf_config() local
1188 ptr->all_switch_events = perf_config_bool(var, value); in intel_pt_perf_config()
1196 struct intel_pt_recording *ptr; in intel_pt_recording_init() local
1206 ptr = zalloc(sizeof(struct intel_pt_recording)); in intel_pt_recording_init()
1207 if (!ptr) { in intel_pt_recording_init()
1212 perf_config(intel_pt_perf_config, ptr); in intel_pt_recording_init()
1214 ptr->intel_pt_pmu = intel_pt_pmu; in intel_pt_recording_init()
1215 ptr->itr.recording_options = intel_pt_recording_options; in intel_pt_recording_init()
1216 ptr->itr.info_priv_size = intel_pt_info_priv_size; in intel_pt_recording_init()
1217 ptr->itr.info_fill = intel_pt_info_fill; in intel_pt_recording_init()
1218 ptr->itr.free = intel_pt_recording_free; in intel_pt_recording_init()
1219 ptr->itr.snapshot_start = intel_pt_snapshot_start; in intel_pt_recording_init()
1220 ptr->itr.snapshot_finish = intel_pt_snapshot_finish; in intel_pt_recording_init()
1221 ptr->itr.find_snapshot = intel_pt_find_snapshot; in intel_pt_recording_init()
1222 ptr->itr.parse_snapshot_options = intel_pt_parse_snapshot_options; in intel_pt_recording_init()
1223 ptr->itr.reference = intel_pt_reference; in intel_pt_recording_init()
1224 ptr->itr.read_finish = auxtrace_record__read_finish; in intel_pt_recording_init()
1229 ptr->itr.default_aux_sample_size = 4096; in intel_pt_recording_init()
1230 return &ptr->itr; in intel_pt_recording_init()