diff options
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 1a4e144a9f8f..a5752d4d3c33 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -286,6 +286,113 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) | |||
286 | return ret; | 286 | return ret; |
287 | } | 287 | } |
288 | 288 | ||
289 | static void | ||
290 | lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) | ||
291 | { | ||
292 | int hardirq, softirq; | ||
293 | char *comm; | ||
294 | |||
295 | comm = trace_find_cmdline(entry->pid); | ||
296 | |||
297 | trace_seq_printf(s, "%8.8s-%-5d ", comm, entry->pid); | ||
298 | trace_seq_printf(s, "%3d", cpu); | ||
299 | trace_seq_printf(s, "%c%c", | ||
300 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : | ||
301 | (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' : '.', | ||
302 | ((entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.')); | ||
303 | |||
304 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; | ||
305 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; | ||
306 | if (hardirq && softirq) { | ||
307 | trace_seq_putc(s, 'H'); | ||
308 | } else { | ||
309 | if (hardirq) { | ||
310 | trace_seq_putc(s, 'h'); | ||
311 | } else { | ||
312 | if (softirq) | ||
313 | trace_seq_putc(s, 's'); | ||
314 | else | ||
315 | trace_seq_putc(s, '.'); | ||
316 | } | ||
317 | } | ||
318 | |||
319 | if (entry->preempt_count) | ||
320 | trace_seq_printf(s, "%x", entry->preempt_count); | ||
321 | else | ||
322 | trace_seq_puts(s, "."); | ||
323 | } | ||
324 | |||
325 | static unsigned long preempt_mark_thresh = 100; | ||
326 | |||
327 | static void | ||
328 | lat_print_timestamp(struct trace_seq *s, u64 abs_usecs, | ||
329 | unsigned long rel_usecs) | ||
330 | { | ||
331 | trace_seq_printf(s, " %4lldus", abs_usecs); | ||
332 | if (rel_usecs > preempt_mark_thresh) | ||
333 | trace_seq_puts(s, "!: "); | ||
334 | else if (rel_usecs > 1) | ||
335 | trace_seq_puts(s, "+: "); | ||
336 | else | ||
337 | trace_seq_puts(s, " : "); | ||
338 | } | ||
339 | |||
340 | int trace_print_context(struct trace_iterator *iter) | ||
341 | { | ||
342 | struct trace_seq *s = &iter->seq; | ||
343 | struct trace_entry *entry = iter->ent; | ||
344 | char *comm = trace_find_cmdline(entry->pid); | ||
345 | unsigned long long t = ns2usecs(iter->ts); | ||
346 | unsigned long usec_rem = do_div(t, USEC_PER_SEC); | ||
347 | unsigned long secs = (unsigned long)t; | ||
348 | |||
349 | if (!trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid)) | ||
350 | goto partial; | ||
351 | if (!trace_seq_printf(s, "[%03d] ", entry->cpu)) | ||
352 | goto partial; | ||
353 | if (!trace_seq_printf(s, "%5lu.%06lu: ", secs, usec_rem)) | ||
354 | goto partial; | ||
355 | |||
356 | return 0; | ||
357 | |||
358 | partial: | ||
359 | return TRACE_TYPE_PARTIAL_LINE; | ||
360 | } | ||
361 | |||
362 | int trace_print_lat_context(struct trace_iterator *iter) | ||
363 | { | ||
364 | u64 next_ts; | ||
365 | struct trace_seq *s = &iter->seq; | ||
366 | struct trace_entry *entry = iter->ent, | ||
367 | *next_entry = trace_find_next_entry(iter, NULL, | ||
368 | &next_ts); | ||
369 | unsigned long verbose = (trace_flags & TRACE_ITER_VERBOSE); | ||
370 | unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start); | ||
371 | unsigned long rel_usecs; | ||
372 | |||
373 | if (!next_entry) | ||
374 | next_ts = iter->ts; | ||
375 | rel_usecs = ns2usecs(next_ts - iter->ts); | ||
376 | |||
377 | if (verbose) { | ||
378 | char *comm = trace_find_cmdline(entry->pid); | ||
379 | trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" | ||
380 | " %ld.%03ldms (+%ld.%03ldms): ", | ||
381 | comm, | ||
382 | entry->pid, entry->cpu, entry->flags, | ||
383 | entry->preempt_count, iter->idx, | ||
384 | ns2usecs(iter->ts), | ||
385 | abs_usecs/1000, | ||
386 | abs_usecs % 1000, rel_usecs/1000, | ||
387 | rel_usecs % 1000); | ||
388 | } else { | ||
389 | lat_print_generic(s, entry, entry->cpu); | ||
390 | lat_print_timestamp(s, abs_usecs, rel_usecs); | ||
391 | } | ||
392 | |||
393 | return 0; | ||
394 | } | ||
395 | |||
289 | static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; | 396 | static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; |
290 | 397 | ||
291 | static int task_state_char(unsigned long state) | 398 | static int task_state_char(unsigned long state) |