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
96 memset(&p->latency_record, 0, sizeof(p->latency_record)); in clear_tsk_latency_tracing()
97 p->latency_record_count = 0; in clear_tsk_latency_tracing()
118 if (!tsk->mm) in account_global_scheduler_latency()
131 unsigned long record = lat->backtrace[q]; in account_global_scheduler_latency()
138 /* 0 entry marks end of backtrace: */ in account_global_scheduler_latency()
144 latency_record[i].time += lat->time; in account_global_scheduler_latency()
145 if (lat->time > latency_record[i].max) in account_global_scheduler_latency()
146 latency_record[i].max = lat->time; in account_global_scheduler_latency()
160 * __account_scheduler_latency - record an occurred latency
161 * @tsk: the task struct of the task hitting the latency
162 * @usecs: the duration of the latency in microseconds
165 * This function is the main entry point for recording latency entries
168 * This function has a few special cases to deal with normal 'non-latency'
187 /* Zero-time sleeps are non-interesting */ in __account_scheduler_latency()
202 for (i = 0; i < tsk->latency_record_count; i++) { in __account_scheduler_latency()
206 mylat = &tsk->latency_record[i]; in __account_scheduler_latency()
210 if (mylat->backtrace[q] != record) { in __account_scheduler_latency()
215 /* 0 entry is end of backtrace */ in __account_scheduler_latency()
220 mylat->count++; in __account_scheduler_latency()
221 mylat->time += lat.time; in __account_scheduler_latency()
222 if (lat.time > mylat->max) in __account_scheduler_latency()
223 mylat->max = lat.time; in __account_scheduler_latency()
231 if (tsk->latency_record_count >= LT_SAVECOUNT) in __account_scheduler_latency()
235 i = tsk->latency_record_count++; in __account_scheduler_latency()
236 memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record)); in __account_scheduler_latency()
246 seq_puts(m, "Latency Top version : v0.1\n"); in lstats_show()
251 if (lr->backtrace[0]) { in lstats_show()
254 lr->count, lr->time, lr->max); in lstats_show()
256 unsigned long bt = lr->backtrace[q]; in lstats_show()