由于jiffies是一个无符号长整型(unsigned long),它有一个最大值(MAX_JIFFY_OFFSET),因此msecs_to_jiffies函数可能会对非常大的毫秒数进行截断。 HZ是内核中的一个配置选项,表示每秒的时钟中断次数。HZ的值会影响jiffies的精度,从而影响msecs_to_jiffies的转换结果。 在进行时间相关的编程时,了解jiffies和msecs_to_j...
new_dev.timer.expires = jiffies + msecs_to_jiffies(value); //设置定时周期 new_dev.timer.function = timer_func; //绑定定时回调函数 new_dev.timer.data = (unsigned long)&new_dev; //回调函数参数 add_timer(&new_dev.timer); //添加并启动定时器 这里要注意一点,代码第6行后定时器会直接运行,...
函数名称:msecs_to_jiffies: - convert milliseconds to jiffies*@m: time in milliseconds* conversion is done as follows:* - negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET)* - 'too large' values [that would result in larger than ...
Name:HZ is equal to or smaller than 1000, and 1000 is a nice round* multiple of HZ, divide with the factor between them, but round* upwards: Proto:static inline unsigned long _msecs_to_jiffies(const unsigned int m) Type:unsigned long Parameter: TypeParameterName const unsigned int m 311...
The majority of the msecs_to_jiffies() users in the kernel are passing in constants which would allow gcc to do constant folding by checking with __builtin_constant_p() in msecs_to_jiffies(). The original msecs_to_jiffies is renamed to __msecs_to_jiffies and aside ...
函数名称:Convert jiffies to milliseconds and back.* Avoid unnecessary multiplications/divisions in the* two most common HZ cases: 返回类型:unsigned int 参数: 类型参数名称 const unsigned longj 377返回:Parameters used to convert the timespec values:除HZ乘j ...