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
71 memset(&p->latency_record, 0, sizeof(p->latency_record)); in clear_tsk_latency_tracing()
72 p->latency_record_count = 0; in clear_tsk_latency_tracing()
93 if (!tsk->mm) in account_global_scheduler_latency()
106 unsigned long record = lat->backtrace[q]; in account_global_scheduler_latency()
113 /* 0 entry marks end of backtrace: */ in account_global_scheduler_latency()
119 latency_record[i].time += lat->time; in account_global_scheduler_latency()
120 if (lat->time > latency_record[i].max) in account_global_scheduler_latency()
121 latency_record[i].max = lat->time; in account_global_scheduler_latency()
127 if (i >= MAXLR - 1) in account_global_scheduler_latency()
135 * __account_scheduler_latency - record an occurred latency
136 * @tsk - the task struct of the task hitting the latency
137 * @usecs - the duration of the latency in microseconds
138 * @inter - 1 if the sleep was interruptible, 0 if uninterruptible
140 * This function is the main entry point for recording latency entries
143 * This function has a few special cases to deal with normal 'non-latency'
162 /* Zero-time sleeps are non-interesting */ in __account_scheduler_latency()
177 for (i = 0; i < tsk->latency_record_count; i++) { in __account_scheduler_latency()
181 mylat = &tsk->latency_record[i]; in __account_scheduler_latency()
185 if (mylat->backtrace[q] != record) { in __account_scheduler_latency()
190 /* 0 entry is end of backtrace */ in __account_scheduler_latency()
195 mylat->count++; in __account_scheduler_latency()
196 mylat->time += lat.time; in __account_scheduler_latency()
197 if (lat.time > mylat->max) in __account_scheduler_latency()
198 mylat->max = lat.time; in __account_scheduler_latency()
206 if (tsk->latency_record_count >= LT_SAVECOUNT) in __account_scheduler_latency()
210 i = tsk->latency_record_count++; in __account_scheduler_latency()
211 memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record)); in __account_scheduler_latency()
221 seq_puts(m, "Latency Top version : v0.1\n"); in lstats_show()
226 if (lr->backtrace[0]) { in lstats_show()
229 lr->count, lr->time, lr->max); in lstats_show()
231 unsigned long bt = lr->backtrace[q]; in lstats_show()