Lines Matching +full:entry +full:- +full:latency
1 // SPDX-License-Identifier: GPL-2.0-only
3 * latencytop.c: Latency display infrastructure
10 * CONFIG_LATENCYTOP enables a kernel latency tracking infrastructure that is
11 * used by the "latencytop" userspace tool. The latency that is tracked is not
12 * the 'traditional' interrupt latency (which is primarily caused by something
13 * else consuming CPU), but instead, it is the latency an application encounters
17 * 1) System level latency
18 * 2) Per process latency
20 * The latency is stored in fixed sized data structures in an accumulated form;
21 * if the "same" latency cause is hit twice, this will be tracked as one entry
22 * in the data structure. Both the count, total accumulated latency and maximum
23 * latency are tracked in this data structure. When the fixed size structure is
27 * A latency cause is identified by a stringified backtrace at the point that
29 * identify the cause of the latency in human readable form.
31 * The information is exported via /proc/latency_stats and /proc/<pid>/latency.
34 * Latency Top version : v0.1
37 * | | | +----> the stringified backtrace
38 * | | +---------> The maximum latency for this entry in microseconds
39 * | +--------------> The accumulated latency for this entry (microseconds)
40 * +-------------------> The number of times this entry is hit
42 * (note: the average latency is the accumulated latency divided by the number
97 memset(&p->latency_record, 0, sizeof(p->latency_record)); in clear_tsk_latency_tracing()
98 p->latency_record_count = 0; in clear_tsk_latency_tracing()
119 if (!tsk->mm) in account_global_scheduler_latency()
132 unsigned long record = lat->backtrace[q]; in account_global_scheduler_latency()
139 /* 0 entry marks end of backtrace: */ in account_global_scheduler_latency()
145 latency_record[i].time += lat->time; in account_global_scheduler_latency()
146 if (lat->time > latency_record[i].max) in account_global_scheduler_latency()
147 latency_record[i].max = lat->time; in account_global_scheduler_latency()
161 * __account_scheduler_latency - record an occurred latency
162 * @tsk - the task struct of the task hitting the latency
163 * @usecs - the duration of the latency in microseconds
164 * @inter - 1 if the sleep was interruptible, 0 if uninterruptible
166 * This function is the main entry point for recording latency entries
169 * This function has a few special cases to deal with normal 'non-latency'
188 /* Zero-time sleeps are non-interesting */ in __account_scheduler_latency()
203 for (i = 0; i < tsk->latency_record_count; i++) { in __account_scheduler_latency()
207 mylat = &tsk->latency_record[i]; in __account_scheduler_latency()
211 if (mylat->backtrace[q] != record) { in __account_scheduler_latency()
216 /* 0 entry is end of backtrace */ in __account_scheduler_latency()
221 mylat->count++; in __account_scheduler_latency()
222 mylat->time += lat.time; in __account_scheduler_latency()
223 if (lat.time > mylat->max) in __account_scheduler_latency()
224 mylat->max = lat.time; in __account_scheduler_latency()
232 if (tsk->latency_record_count >= LT_SAVECOUNT) in __account_scheduler_latency()
236 i = tsk->latency_record_count++; in __account_scheduler_latency()
237 memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record)); in __account_scheduler_latency()
247 seq_puts(m, "Latency Top version : v0.1\n"); in lstats_show()
252 if (lr->backtrace[0]) { in lstats_show()
255 lr->count, lr->time, lr->max); in lstats_show()
257 unsigned long bt = lr->backtrace[q]; in lstats_show()