函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace_hwlat.c Create Date:2022-07-27 13:17:36
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:get_sample - sample the CPU TSC and look for likely hardware latencies* Used to repeatedly capture the CPU TSC (or similar), looking for potential* hardware-induced latency. Called with interrupts disabled and with* hwlat_data.lock held.

函数原型:static int get_sample(void)

返回类型:int

参数:

169  tr等于hwlat_trace
170  Macros to encapsulate the time capturing infrastructure  start, t1, t2, last_t2
171  last_total等于0
172  sample等于0
173  thresh等于tracing_thresh
174  outer_sample等于0
175  ret等于负1
177  do_div() is NOT a C function(thresh, NSEC_PER_USEC)
179  nmi_cpu等于当前cpu ID()
180  nmi_total_ts等于0
181  nmi_count等于0
183  The "volatile" is due to gcc bugs ()
185  Tells NMIs to call back to the hwlat tracer to record timestamps = true
187  init_time(last_t2, 0)
188  start等于time_get()
190  循环
192  t1等于time_get()
193  t2等于time_get()
195  如果time_u64(last_t2)则
199  如果diff小于0则
200  打印错误信息(BANNER"time running backwards\n")
201  转到:out
203  如果diff大于outer_sampleouter_sample等于diff
206  last_t2等于t2
208  total等于time_to_us(time_sub(t2, start))
211  如果total小于last_total
212  打印错误信息("Time total overflowed\n")
213  退出
215  last_total等于total
218  diff等于time_to_us(time_sub(t2, t1))
221  如果diff小于0则
222  打印错误信息(BANNER"time running backwards\n")
223  转到:out
226  如果diff大于samplesample等于diff
229 total小于等于active sampling portion of window 循环
231  The "volatile" is due to gcc bugs ()
232  Tells NMIs to call back to the hwlat tracer to record timestamps = false
233  The "volatile" is due to gcc bugs ()
235  ret等于0
238  如果sample大于threshouter_sample大于thresh
242  ret等于1
245  如果nmi_total_tsdo_div() is NOT a C function(nmi_total_ts, NSEC_PER_USEC)
248  al since reset 自加
249  unique sequence 等于al since reset
250  delta 等于sample
251  delta (outer loop) 等于outer_sample
252  ktime_get_real_ts64 - Returns the time of day in a timespec64.*@ts: pointer to the timespec to be set* Returns the time of day in a timespec64 (WARN if suspended).
253  Total time spent in NMIs 等于nmi_total_ts
254  # NMIs during this sample 等于nmi_count
255  trace_hwlat_sample( & s)
257  latency等于两数取大(sample, outer_sample)
260  如果latency大于max_latency
261  max_latency等于latency
266  out :
267  返回:ret
调用者
名称描述
kthread_fnkthread_fn - The CPU time sampling/hardware latency detection kernel thread* Used to periodically sample the CPU TSC via a call to get_sample. We* disable interrupts, which does (intentionally) introduce latency since we