Commit 34e49d4f635d6a800c4089c40fd254e12e451449
Committed by
Linus Torvalds
1 parent
1bdcd78e24
fs/proc/base.c, kernel/latencytop.c: convert sprintf_symbol() to %ps
Use temporary lr for struct latency_record for improved readability and fewer columns used. Removed trailing space from output. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Joe Perches <joe@perches.com> Cc: Jiri Kosina <trivial@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 17 additions and 28 deletions Side-by-side Diff
fs/proc/base.c
... | ... | @@ -373,24 +373,18 @@ |
373 | 373 | return -ESRCH; |
374 | 374 | seq_puts(m, "Latency Top version : v0.1\n"); |
375 | 375 | for (i = 0; i < 32; i++) { |
376 | - if (task->latency_record[i].backtrace[0]) { | |
376 | + struct latency_record *lr = &task->latency_record[i]; | |
377 | + if (lr->backtrace[0]) { | |
377 | 378 | int q; |
378 | - seq_printf(m, "%i %li %li ", | |
379 | - task->latency_record[i].count, | |
380 | - task->latency_record[i].time, | |
381 | - task->latency_record[i].max); | |
379 | + seq_printf(m, "%i %li %li", | |
380 | + lr->count, lr->time, lr->max); | |
382 | 381 | for (q = 0; q < LT_BACKTRACEDEPTH; q++) { |
383 | - char sym[KSYM_SYMBOL_LEN]; | |
384 | - char *c; | |
385 | - if (!task->latency_record[i].backtrace[q]) | |
382 | + unsigned long bt = lr->backtrace[q]; | |
383 | + if (!bt) | |
386 | 384 | break; |
387 | - if (task->latency_record[i].backtrace[q] == ULONG_MAX) | |
385 | + if (bt == ULONG_MAX) | |
388 | 386 | break; |
389 | - sprint_symbol(sym, task->latency_record[i].backtrace[q]); | |
390 | - c = strchr(sym, '+'); | |
391 | - if (c) | |
392 | - *c = 0; | |
393 | - seq_printf(m, "%s ", sym); | |
387 | + seq_printf(m, " %ps", (void *)bt); | |
394 | 388 | } |
395 | 389 | seq_printf(m, "\n"); |
396 | 390 | } |
kernel/latencytop.c
... | ... | @@ -241,24 +241,19 @@ |
241 | 241 | seq_puts(m, "Latency Top version : v0.1\n"); |
242 | 242 | |
243 | 243 | for (i = 0; i < MAXLR; i++) { |
244 | - if (latency_record[i].backtrace[0]) { | |
244 | + struct latency_record *lr = &latency_record[i]; | |
245 | + | |
246 | + if (lr->backtrace[0]) { | |
245 | 247 | int q; |
246 | - seq_printf(m, "%i %lu %lu ", | |
247 | - latency_record[i].count, | |
248 | - latency_record[i].time, | |
249 | - latency_record[i].max); | |
248 | + seq_printf(m, "%i %lu %lu", | |
249 | + lr->count, lr->time, lr->max); | |
250 | 250 | for (q = 0; q < LT_BACKTRACEDEPTH; q++) { |
251 | - char sym[KSYM_SYMBOL_LEN]; | |
252 | - char *c; | |
253 | - if (!latency_record[i].backtrace[q]) | |
251 | + unsigned long bt = lr->backtrace[q]; | |
252 | + if (!bt) | |
254 | 253 | break; |
255 | - if (latency_record[i].backtrace[q] == ULONG_MAX) | |
254 | + if (bt == ULONG_MAX) | |
256 | 255 | break; |
257 | - sprint_symbol(sym, latency_record[i].backtrace[q]); | |
258 | - c = strchr(sym, '+'); | |
259 | - if (c) | |
260 | - *c = 0; | |
261 | - seq_printf(m, "%s ", sym); | |
256 | + seq_printf(m, " %ps", (void *)bt); | |
262 | 257 | } |
263 | 258 | seq_printf(m, "\n"); |
264 | 259 | } |