Function report |
Source Code:kernel\trace\trace_hwlat.c |
Create Date:2022-07-28 12:10:48 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name: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.
Proto:static int get_sample(void)
Type:int
Parameter:Nothing
| 169 | tr = hwlat_trace |
| 171 | last_total = 0 |
| 172 | sample = 0 |
| 173 | thresh = tracing_thresh |
| 174 | outer_sample = 0 |
| 175 | ret = -1 |
| 179 | nmi_cpu = smp_processor_id() |
| 180 | nmi_total_ts = 0 |
| 181 | nmi_count = 0 |
| 190 | Do |
| 197 | diff = time_to_us(time_sub(t1, last_t2)) |
| 199 | If diff < 0 Then |
| 203 | If diff > outer_sample Then outer_sample = diff |
| 208 | total = time_to_us(time_sub(t2, start)) |
| 211 | If total < last_total Then |
| 212 | pr_err("Time total overflowed\n") |
| 213 | Break |
| 215 | last_total = total |
| 218 | diff = time_to_us(time_sub(t2, t1)) |
| 221 | If diff < 0 Then |
| 229 | When total <= active sampling portion of window cycle |
| 235 | ret = 0 |
| 238 | If sample > thresh || outer_sample > thresh Then |
| 242 | ret = 1 |
| 245 | If nmi_total_ts Then do_div() is NOT a C function(nmi_total_ts, NSEC_PER_USEC) |
| 248 | al since reset ++ |
| 255 | trace_hwlat_sample( & s) |
| 257 | latency = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(sample, outer_sample) |
| 260 | If latency > max_latency Then |
| 261 | max_latency = latency |
| 262 | latency_fsnotify(tr) |
| 266 | out : |
| 267 | Return ret |
| Name | Describe |
|---|---|
| kthread_fn | kthread_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 |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |