Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sched\cputime.c Create Date:2022-07-28 09:37:37
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Perform (stime * rtime) / total, but avoid multiplication overflow by* losing precision when the numbers are big.

Proto:static u64 scale_stime(u64 stime, u64 rtime, u64 total)

Type:u64

Parameter:

TypeParameterName
u64stime
u64rtime
u64total
533  cycle
535  If stime > rtime Then swap - swap values of @a and @b*@a: first value*@b: second value(rtime, stime)
539  If total >> 32 Then Go to drop_precision
543  If Not (rtime >> 32) Then Break
547  If stime >> 31 Then Go to drop_precision
551  stime <<= 1
552  rtime >>= 1
553  Continue
555  drop_precision :
557  rtime >>= 1
558  total >>= 1
565  scaled = div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full
566  Return scaled
Caller
NameDescribe
cputime_adjustAdjust tick based cputime random precision against scheduler runtime* accounting