Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\core.c Create Date:2022-07-28 13:37:08
Last Modify:2022-05-20 07:50:19 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:perf_prepare_sample

Proto:void perf_prepare_sample(struct perf_event_header *header, struct perf_sample_data *data, struct perf_event *event, struct pt_regs *regs)

Type:void

Parameter:

TypeParameterName
struct perf_event_header *header
struct perf_sample_data *data
struct perf_event *event
struct pt_regs *regs
6787  sample_type = sample_type
6789  type = PERF_RECORD_SAMPLE
6790  size = size of header + header_size
6792  misc = 0
6793  misc |= perf_misc_flags(regs)
6795  __perf_event_header__init_id(header, data, event)
6797  If sample_type & PERF_SAMPLE_IP Then ip = perf_instruction_pointer(regs)
6800  If sample_type & PERF_SAMPLE_CALLCHAIN Then
6801  size = 1
6803  If Not (sample_type & __PERF_SAMPLE_CALLCHAIN_EARLY) Then callchain = perf_callchain(event, regs)
6806  size += nr
6808  size += size * sizeof(u64)
6811  If sample_type & PERF_SAMPLE_RAW Then
6812  raw = raw
6815  If raw Then
6816  frag = frag
6817  sum = 0
6819  Do
6820  sum += size
6821  If perf_raw_frag_last(frag) Then Break
6823  frag = next
6824  When 1 cycle
6827  size = size - sizeof(u32)
6828  pad = size - sum
6829  Else
6830  size = sizeof(u64)
6833  size += size
6836  If sample_type & PERF_SAMPLE_BRANCH_STACK Then
6837  size = sizeof(u64)
6838  If br_stack Then
6839  size += nr * sizeof(structperf_branch_entry)
6842  size += size
6845  If sample_type & (PERF_SAMPLE_REGS_USER | PERF_SAMPLE_STACK_USER) Then perf_sample_regs_user( & regs_user, regs, & regs_user_copy)
6849  If sample_type & PERF_SAMPLE_REGS_USER Then
6851  size = sizeof(u64)
6853  If regs Then
6858  size += size
6861  If sample_type & PERF_SAMPLE_STACK_USER Then
6868  stack_size = sample_stack_user
6869  size = sizeof(u64)
6871  stack_size = perf_sample_ustack_size(stack_size, size, regs)
6879  If stack_size Then size += sizeof(u64) + stack_size
6882  stack_user_size = stack_size
6883  size += size
6886  If sample_type & PERF_SAMPLE_REGS_INTR Then
6888  size = sizeof(u64)
6890  perf_sample_regs_intr( & regs_intr, regs)
6892  If regs Then
6898  size += size
6901  If sample_type & PERF_SAMPLE_PHYS_ADDR Then phys_addr = perf_virt_to_phys(addr)
6904  If sample_type & PERF_SAMPLE_AUX Then
6907  size += sizeof(u64)
6915  size = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, U16_MAX - size, aux_sample_size)
6917  size = unddown - round down to next specified multiple*@x: the value to round*@y: multiple to round down to* Rounds @x down to next multiple of @y. If @y will always be a power* of 2, consider using the faster round_down().(size, 8)
6918  size = perf_prepare_sample_aux(event, data, size)
6920  WARN_ON_ONCE(size + size > U16_MAX)
6921  size += size
6931  WARN_ON_ONCE(size & 7)
Caller
NameDescribe
__perf_event_output