Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:perf_calculate_period

Proto:static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count)

Type:u64

Parameter:

TypeParameterName
struct perf_event *event
u64nsec
u64count
3637  frequency = sample_freq
3638  sec = NSEC_PER_SEC
3643  count_fls = ls64 - find last set bit in a 64-bit word*@x: the word to search* This is defined in a similar way as the libc and compiler builtin* ffsll, but returns the position of the most significant set bit
3644  nsec_fls = ls64 - find last set bit in a 64-bit word*@x: the word to search* This is defined in a similar way as the libc and compiler builtin* ffsll, but returns the position of the most significant set bit
3645  frequency_fls = ls64 - find last set bit in a 64-bit word*@x: the word to search* This is defined in a similar way as the libc and compiler builtin* ffsll, but returns the position of the most significant set bit
3646  sec_fls = 30
3677  When count_fls + sec_fls > 64 && nsec_fls + frequency_fls > 64 cycle
3678  Reduce accuracy by one bit such that @a and @b converge* to a similar magnitude.(nsec, frequency)
3679  Reduce accuracy by one bit such that @a and @b converge* to a similar magnitude.(sec, count)
3682  If count_fls + sec_fls > 64 Then
3683  divisor = nsec * frequency
3685  When count_fls + sec_fls > 64 cycle
3687  divisor >>= 1
3690  dividend = count * sec
3691  Else
3692  dividend = count * sec
3694  When nsec_fls + frequency_fls > 64 cycle
3696  dividend >>= 1
3699  divisor = nsec * frequency
3702  If Not divisor Then Return dividend
3705  Return div64_u64 - unsigned 64bit divide with 64bit divisor*@dividend: 64bit dividend*@divisor: 64bit divisor* This implementation is a modified version of the algorithm proposed* by the book 'Hacker's Delight'. The original source and full proof
Caller
NameDescribe
perf_adjust_period