Commit 9d9add34 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Have function_graph use trace_seq_has_overflowed()

Instead of doing individual checks all over the place that makes the code
very messy. Just check trace_seq_has_overflowed() at the end or in
strategic places.

This makes the code much cleaner and also helps with getting closer
to removing the return values of trace_seq_printf() and friends.

Link: http://lkml.kernel.org/r/20141114011410.987913836@goodmis.orgReviewed-by: default avatarPetr Mladek <pmladek@suse.cz>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 7d40f671
...@@ -726,7 +726,7 @@ extern unsigned long trace_flags; ...@@ -726,7 +726,7 @@ extern unsigned long trace_flags;
extern enum print_line_t extern enum print_line_t
print_graph_function_flags(struct trace_iterator *iter, u32 flags); print_graph_function_flags(struct trace_iterator *iter, u32 flags);
extern void print_graph_headers_flags(struct seq_file *s, u32 flags); extern void print_graph_headers_flags(struct seq_file *s, u32 flags);
extern enum print_line_t extern void
trace_print_graph_duration(unsigned long long duration, struct trace_seq *s); trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
extern void graph_trace_open(struct trace_iterator *iter); extern void graph_trace_open(struct trace_iterator *iter);
extern void graph_trace_close(struct trace_iterator *iter); extern void graph_trace_close(struct trace_iterator *iter);
......
...@@ -107,7 +107,7 @@ enum { ...@@ -107,7 +107,7 @@ enum {
FLAGS_FILL_END = 3 << TRACE_GRAPH_PRINT_FILL_SHIFT, FLAGS_FILL_END = 3 << TRACE_GRAPH_PRINT_FILL_SHIFT,
}; };
static enum print_line_t static void
print_graph_duration(unsigned long long duration, struct trace_seq *s, print_graph_duration(unsigned long long duration, struct trace_seq *s,
u32 flags); u32 flags);
...@@ -483,33 +483,24 @@ static int graph_trace_update_thresh(struct trace_array *tr) ...@@ -483,33 +483,24 @@ static int graph_trace_update_thresh(struct trace_array *tr)
static int max_bytes_for_cpu; static int max_bytes_for_cpu;
static enum print_line_t static void print_graph_cpu(struct trace_seq *s, int cpu)
print_graph_cpu(struct trace_seq *s, int cpu)
{ {
int ret;
/* /*
* Start with a space character - to make it stand out * Start with a space character - to make it stand out
* to the right a bit when trace output is pasted into * to the right a bit when trace output is pasted into
* email: * email:
*/ */
ret = trace_seq_printf(s, " %*d) ", max_bytes_for_cpu, cpu); trace_seq_printf(s, " %*d) ", max_bytes_for_cpu, cpu);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED;
} }
#define TRACE_GRAPH_PROCINFO_LENGTH 14 #define TRACE_GRAPH_PROCINFO_LENGTH 14
static enum print_line_t static void print_graph_proc(struct trace_seq *s, pid_t pid)
print_graph_proc(struct trace_seq *s, pid_t pid)
{ {
char comm[TASK_COMM_LEN]; char comm[TASK_COMM_LEN];
/* sign + log10(MAX_INT) + '\0' */ /* sign + log10(MAX_INT) + '\0' */
char pid_str[11]; char pid_str[11];
int spaces = 0; int spaces = 0;
int ret;
int len; int len;
int i; int i;
...@@ -524,56 +515,43 @@ print_graph_proc(struct trace_seq *s, pid_t pid) ...@@ -524,56 +515,43 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
spaces = TRACE_GRAPH_PROCINFO_LENGTH - len; spaces = TRACE_GRAPH_PROCINFO_LENGTH - len;
/* First spaces to align center */ /* First spaces to align center */
for (i = 0; i < spaces / 2; i++) { for (i = 0; i < spaces / 2; i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
ret = trace_seq_printf(s, "%s-%s", comm, pid_str); trace_seq_printf(s, "%s-%s", comm, pid_str);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
/* Last spaces to align center */ /* Last spaces to align center */
for (i = 0; i < spaces - (spaces / 2); i++) { for (i = 0; i < spaces - (spaces / 2); i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
return TRACE_TYPE_HANDLED;
} }
static enum print_line_t static void print_graph_lat_fmt(struct trace_seq *s, struct trace_entry *entry)
print_graph_lat_fmt(struct trace_seq *s, struct trace_entry *entry)
{ {
if (!trace_seq_putc(s, ' ')) trace_seq_putc(s, ' ');
return 0; trace_print_lat_fmt(s, entry);
return trace_print_lat_fmt(s, entry);
} }
/* If the pid changed since the last trace, output this event */ /* If the pid changed since the last trace, output this event */
static enum print_line_t static void
verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
{ {
pid_t prev_pid; pid_t prev_pid;
pid_t *last_pid; pid_t *last_pid;
int ret;
if (!data) if (!data)
return TRACE_TYPE_HANDLED; return;
last_pid = &(per_cpu_ptr(data->cpu_data, cpu)->last_pid); last_pid = &(per_cpu_ptr(data->cpu_data, cpu)->last_pid);
if (*last_pid == pid) if (*last_pid == pid)
return TRACE_TYPE_HANDLED; return;
prev_pid = *last_pid; prev_pid = *last_pid;
*last_pid = pid; *last_pid = pid;
if (prev_pid == -1) if (prev_pid == -1)
return TRACE_TYPE_HANDLED; return;
/* /*
* Context-switch trace line: * Context-switch trace line:
...@@ -582,33 +560,12 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) ...@@ -582,33 +560,12 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
------------------------------------------ ------------------------------------------
*/ */
ret = trace_seq_puts(s, trace_seq_puts(s, " ------------------------------------------\n");
" ------------------------------------------\n"); print_graph_cpu(s, cpu);
if (!ret) print_graph_proc(s, prev_pid);
return TRACE_TYPE_PARTIAL_LINE; trace_seq_puts(s, " => ");
print_graph_proc(s, pid);
ret = print_graph_cpu(s, cpu); trace_seq_puts(s, "\n ------------------------------------------\n\n");
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
ret = print_graph_proc(s, prev_pid);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_puts(s, " => ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
ret = print_graph_proc(s, pid);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_puts(s,
"\n ------------------------------------------\n\n");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED;
} }
static struct ftrace_graph_ret_entry * static struct ftrace_graph_ret_entry *
...@@ -682,103 +639,74 @@ get_return_for_leaf(struct trace_iterator *iter, ...@@ -682,103 +639,74 @@ get_return_for_leaf(struct trace_iterator *iter,
return next; return next;
} }
static int print_graph_abs_time(u64 t, struct trace_seq *s) static void print_graph_abs_time(u64 t, struct trace_seq *s)
{ {
unsigned long usecs_rem; unsigned long usecs_rem;
usecs_rem = do_div(t, NSEC_PER_SEC); usecs_rem = do_div(t, NSEC_PER_SEC);
usecs_rem /= 1000; usecs_rem /= 1000;
return trace_seq_printf(s, "%5lu.%06lu | ", trace_seq_printf(s, "%5lu.%06lu | ",
(unsigned long)t, usecs_rem); (unsigned long)t, usecs_rem);
} }
static enum print_line_t static void
print_graph_irq(struct trace_iterator *iter, unsigned long addr, print_graph_irq(struct trace_iterator *iter, unsigned long addr,
enum trace_type type, int cpu, pid_t pid, u32 flags) enum trace_type type, int cpu, pid_t pid, u32 flags)
{ {
int ret;
struct trace_seq *s = &iter->seq; struct trace_seq *s = &iter->seq;
struct trace_entry *ent = iter->ent; struct trace_entry *ent = iter->ent;
if (addr < (unsigned long)__irqentry_text_start || if (addr < (unsigned long)__irqentry_text_start ||
addr >= (unsigned long)__irqentry_text_end) addr >= (unsigned long)__irqentry_text_end)
return TRACE_TYPE_UNHANDLED; return;
if (trace_flags & TRACE_ITER_CONTEXT_INFO) { if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
/* Absolute time */ /* Absolute time */
if (flags & TRACE_GRAPH_PRINT_ABS_TIME) { if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
ret = print_graph_abs_time(iter->ts, s); print_graph_abs_time(iter->ts, s);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
/* Cpu */ /* Cpu */
if (flags & TRACE_GRAPH_PRINT_CPU) { if (flags & TRACE_GRAPH_PRINT_CPU)
ret = print_graph_cpu(s, cpu); print_graph_cpu(s, cpu);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}
/* Proc */ /* Proc */
if (flags & TRACE_GRAPH_PRINT_PROC) { if (flags & TRACE_GRAPH_PRINT_PROC) {
ret = print_graph_proc(s, pid); print_graph_proc(s, pid);
if (ret == TRACE_TYPE_PARTIAL_LINE) trace_seq_puts(s, " | ");
return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_puts(s, " | ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
} }
/* Latency format */ /* Latency format */
if (trace_flags & TRACE_ITER_LATENCY_FMT) { if (trace_flags & TRACE_ITER_LATENCY_FMT)
ret = print_graph_lat_fmt(s, ent); print_graph_lat_fmt(s, ent);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}
} }
/* No overhead */ /* No overhead */
ret = print_graph_duration(0, s, flags | FLAGS_FILL_START); print_graph_duration(0, s, flags | FLAGS_FILL_START);
if (ret != TRACE_TYPE_HANDLED)
return ret;
if (type == TRACE_GRAPH_ENT) if (type == TRACE_GRAPH_ENT)
ret = trace_seq_puts(s, "==========>"); trace_seq_puts(s, "==========>");
else else
ret = trace_seq_puts(s, "<=========="); trace_seq_puts(s, "<==========");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
ret = print_graph_duration(0, s, flags | FLAGS_FILL_END); print_graph_duration(0, s, flags | FLAGS_FILL_END);
if (ret != TRACE_TYPE_HANDLED) trace_seq_putc(s, '\n');
return ret;
ret = trace_seq_putc(s, '\n');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED;
} }
enum print_line_t void
trace_print_graph_duration(unsigned long long duration, struct trace_seq *s) trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
{ {
unsigned long nsecs_rem = do_div(duration, 1000); unsigned long nsecs_rem = do_div(duration, 1000);
/* log10(ULONG_MAX) + '\0' */ /* log10(ULONG_MAX) + '\0' */
char usecs_str[21]; char usecs_str[21];
char nsecs_str[5]; char nsecs_str[5];
int ret, len; int len;
int i; int i;
sprintf(usecs_str, "%lu", (unsigned long) duration); sprintf(usecs_str, "%lu", (unsigned long) duration);
/* Print msecs */ /* Print msecs */
ret = trace_seq_printf(s, "%s", usecs_str); trace_seq_printf(s, "%s", usecs_str);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
len = strlen(usecs_str); len = strlen(usecs_str);
...@@ -787,79 +715,63 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s) ...@@ -787,79 +715,63 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
size_t slen = min_t(size_t, sizeof(nsecs_str), 8UL - len); size_t slen = min_t(size_t, sizeof(nsecs_str), 8UL - len);
snprintf(nsecs_str, slen, "%03lu", nsecs_rem); snprintf(nsecs_str, slen, "%03lu", nsecs_rem);
ret = trace_seq_printf(s, ".%s", nsecs_str); trace_seq_printf(s, ".%s", nsecs_str);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
len += strlen(nsecs_str); len += strlen(nsecs_str);
} }
ret = trace_seq_puts(s, " us "); trace_seq_puts(s, " us ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
/* Print remaining spaces to fit the row's width */ /* Print remaining spaces to fit the row's width */
for (i = len; i < 7; i++) { for (i = len; i < 7; i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
return TRACE_TYPE_HANDLED;
} }
static enum print_line_t static void
print_graph_duration(unsigned long long duration, struct trace_seq *s, print_graph_duration(unsigned long long duration, struct trace_seq *s,
u32 flags) u32 flags)
{ {
int ret = -1; bool duration_printed = false;
if (!(flags & TRACE_GRAPH_PRINT_DURATION) || if (!(flags & TRACE_GRAPH_PRINT_DURATION) ||
!(trace_flags & TRACE_ITER_CONTEXT_INFO)) !(trace_flags & TRACE_ITER_CONTEXT_INFO))
return TRACE_TYPE_HANDLED; return;
/* No real adata, just filling the column with spaces */ /* No real adata, just filling the column with spaces */
switch (flags & TRACE_GRAPH_PRINT_FILL_MASK) { switch (flags & TRACE_GRAPH_PRINT_FILL_MASK) {
case FLAGS_FILL_FULL: case FLAGS_FILL_FULL:
ret = trace_seq_puts(s, " | "); trace_seq_puts(s, " | ");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; return;
case FLAGS_FILL_START: case FLAGS_FILL_START:
ret = trace_seq_puts(s, " "); trace_seq_puts(s, " ");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; return;
case FLAGS_FILL_END: case FLAGS_FILL_END:
ret = trace_seq_puts(s, " |"); trace_seq_puts(s, " |");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; return;
} }
/* Signal a overhead of time execution to the output */ /* Signal a overhead of time execution to the output */
if (flags & TRACE_GRAPH_PRINT_OVERHEAD) { if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
/* Duration exceeded 100 usecs */ /* Duration exceeded 100 usecs */
if (duration > 100000ULL) if (duration > 100000ULL) {
ret = trace_seq_puts(s, "! "); trace_seq_puts(s, "! ");
duration_printed = true;
/* Duration exceeded 10 usecs */ /* Duration exceeded 10 usecs */
else if (duration > 10000ULL) } else if (duration > 10000ULL) {
ret = trace_seq_puts(s, "+ "); trace_seq_puts(s, "+ ");
duration_printed = true;
}
} }
/* /*
* The -1 means we either did not exceed the duration tresholds * If we did not exceed the duration tresholds or we dont want
* or we dont want to print out the overhead. Either way we need * to print out the overhead. Either way we need to fill out the space.
* to fill out the space.
*/ */
if (ret == -1) if (!duration_printed)
ret = trace_seq_puts(s, " "); trace_seq_puts(s, " ");
/* Catching here any failure happenned above */ trace_print_graph_duration(duration, s);
if (!ret) trace_seq_puts(s, "| ");
return TRACE_TYPE_PARTIAL_LINE;
ret = trace_print_graph_duration(duration, s);
if (ret != TRACE_TYPE_HANDLED)
return ret;
ret = trace_seq_puts(s, "| ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED;
} }
/* Case of a leaf function on its call entry */ /* Case of a leaf function on its call entry */
...@@ -873,7 +785,6 @@ print_graph_entry_leaf(struct trace_iterator *iter, ...@@ -873,7 +785,6 @@ print_graph_entry_leaf(struct trace_iterator *iter,
struct ftrace_graph_ret *graph_ret; struct ftrace_graph_ret *graph_ret;
struct ftrace_graph_ent *call; struct ftrace_graph_ent *call;
unsigned long long duration; unsigned long long duration;
int ret;
int i; int i;
graph_ret = &ret_entry->ret; graph_ret = &ret_entry->ret;
...@@ -899,22 +810,15 @@ print_graph_entry_leaf(struct trace_iterator *iter, ...@@ -899,22 +810,15 @@ print_graph_entry_leaf(struct trace_iterator *iter,
} }
/* Overhead and duration */ /* Overhead and duration */
ret = print_graph_duration(duration, s, flags); print_graph_duration(duration, s, flags);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
/* Function */ /* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
ret = trace_seq_printf(s, "%ps();\n", (void *)call->func); trace_seq_printf(s, "%ps();\n", (void *)call->func);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED; return trace_handle_return(s);
} }
static enum print_line_t static enum print_line_t
...@@ -924,7 +828,6 @@ print_graph_entry_nested(struct trace_iterator *iter, ...@@ -924,7 +828,6 @@ print_graph_entry_nested(struct trace_iterator *iter,
{ {
struct ftrace_graph_ent *call = &entry->graph_ent; struct ftrace_graph_ent *call = &entry->graph_ent;
struct fgraph_data *data = iter->private; struct fgraph_data *data = iter->private;
int ret;
int i; int i;
if (data) { if (data) {
...@@ -940,19 +843,15 @@ print_graph_entry_nested(struct trace_iterator *iter, ...@@ -940,19 +843,15 @@ print_graph_entry_nested(struct trace_iterator *iter,
} }
/* No time */ /* No time */
ret = print_graph_duration(0, s, flags | FLAGS_FILL_FULL); print_graph_duration(0, s, flags | FLAGS_FILL_FULL);
if (ret != TRACE_TYPE_HANDLED)
return ret;
/* Function */ /* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
ret = trace_seq_printf(s, "%ps() {\n", (void *)call->func); trace_seq_printf(s, "%ps() {\n", (void *)call->func);
if (!ret)
if (trace_seq_has_overflowed(s))
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
/* /*
...@@ -962,62 +861,43 @@ print_graph_entry_nested(struct trace_iterator *iter, ...@@ -962,62 +861,43 @@ print_graph_entry_nested(struct trace_iterator *iter,
return TRACE_TYPE_NO_CONSUME; return TRACE_TYPE_NO_CONSUME;
} }
static enum print_line_t static void
print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s, print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,
int type, unsigned long addr, u32 flags) int type, unsigned long addr, u32 flags)
{ {
struct fgraph_data *data = iter->private; struct fgraph_data *data = iter->private;
struct trace_entry *ent = iter->ent; struct trace_entry *ent = iter->ent;
int cpu = iter->cpu; int cpu = iter->cpu;
int ret;
/* Pid */ /* Pid */
if (verif_pid(s, ent->pid, cpu, data) == TRACE_TYPE_PARTIAL_LINE) verif_pid(s, ent->pid, cpu, data);
return TRACE_TYPE_PARTIAL_LINE;
if (type) { if (type)
/* Interrupt */ /* Interrupt */
ret = print_graph_irq(iter, addr, type, cpu, ent->pid, flags); print_graph_irq(iter, addr, type, cpu, ent->pid, flags);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}
if (!(trace_flags & TRACE_ITER_CONTEXT_INFO)) if (!(trace_flags & TRACE_ITER_CONTEXT_INFO))
return 0; return;
/* Absolute time */ /* Absolute time */
if (flags & TRACE_GRAPH_PRINT_ABS_TIME) { if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
ret = print_graph_abs_time(iter->ts, s); print_graph_abs_time(iter->ts, s);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
/* Cpu */ /* Cpu */
if (flags & TRACE_GRAPH_PRINT_CPU) { if (flags & TRACE_GRAPH_PRINT_CPU)
ret = print_graph_cpu(s, cpu); print_graph_cpu(s, cpu);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}
/* Proc */ /* Proc */
if (flags & TRACE_GRAPH_PRINT_PROC) { if (flags & TRACE_GRAPH_PRINT_PROC) {
ret = print_graph_proc(s, ent->pid); print_graph_proc(s, ent->pid);
if (ret == TRACE_TYPE_PARTIAL_LINE) trace_seq_puts(s, " | ");
return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_puts(s, " | ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
} }
/* Latency format */ /* Latency format */
if (trace_flags & TRACE_ITER_LATENCY_FMT) { if (trace_flags & TRACE_ITER_LATENCY_FMT)
ret = print_graph_lat_fmt(s, ent); print_graph_lat_fmt(s, ent);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}
return 0; return;
} }
/* /*
...@@ -1135,8 +1015,7 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s, ...@@ -1135,8 +1015,7 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
if (check_irq_entry(iter, flags, call->func, call->depth)) if (check_irq_entry(iter, flags, call->func, call->depth))
return TRACE_TYPE_HANDLED; return TRACE_TYPE_HANDLED;
if (print_graph_prologue(iter, s, TRACE_GRAPH_ENT, call->func, flags)) print_graph_prologue(iter, s, TRACE_GRAPH_ENT, call->func, flags);
return TRACE_TYPE_PARTIAL_LINE;
leaf_ret = get_return_for_leaf(iter, field); leaf_ret = get_return_for_leaf(iter, field);
if (leaf_ret) if (leaf_ret)
...@@ -1169,7 +1048,6 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, ...@@ -1169,7 +1048,6 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
pid_t pid = ent->pid; pid_t pid = ent->pid;
int cpu = iter->cpu; int cpu = iter->cpu;
int func_match = 1; int func_match = 1;
int ret;
int i; int i;
if (check_irq_return(iter, flags, trace->depth)) if (check_irq_return(iter, flags, trace->depth))
...@@ -1195,20 +1073,14 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, ...@@ -1195,20 +1073,14 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
} }
} }
if (print_graph_prologue(iter, s, 0, 0, flags)) print_graph_prologue(iter, s, 0, 0, flags);
return TRACE_TYPE_PARTIAL_LINE;
/* Overhead and duration */ /* Overhead and duration */
ret = print_graph_duration(duration, s, flags); print_graph_duration(duration, s, flags);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
/* Closing brace */ /* Closing brace */
for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
/* /*
* If the return function does not have a matching entry, * If the return function does not have a matching entry,
...@@ -1217,30 +1089,20 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, ...@@ -1217,30 +1089,20 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
* belongs to, write out the function name. Always do * belongs to, write out the function name. Always do
* that if the funcgraph-tail option is enabled. * that if the funcgraph-tail option is enabled.
*/ */
if (func_match && !(flags & TRACE_GRAPH_PRINT_TAIL)) { if (func_match && !(flags & TRACE_GRAPH_PRINT_TAIL))
ret = trace_seq_puts(s, "}\n"); trace_seq_puts(s, "}\n");
if (!ret) else
return TRACE_TYPE_PARTIAL_LINE; trace_seq_printf(s, "} /* %ps */\n", (void *)trace->func);
} else {
ret = trace_seq_printf(s, "} /* %ps */\n", (void *)trace->func);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
/* Overrun */ /* Overrun */
if (flags & TRACE_GRAPH_PRINT_OVERRUN) { if (flags & TRACE_GRAPH_PRINT_OVERRUN)
ret = trace_seq_printf(s, " (Overruns: %lu)\n", trace_seq_printf(s, " (Overruns: %lu)\n",
trace->overrun); trace->overrun);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
ret = print_graph_irq(iter, trace->func, TRACE_GRAPH_RET, print_graph_irq(iter, trace->func, TRACE_GRAPH_RET,
cpu, pid, flags); cpu, pid, flags);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED; return trace_handle_return(s);
} }
static enum print_line_t static enum print_line_t
...@@ -1257,26 +1119,18 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, ...@@ -1257,26 +1119,18 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
if (data) if (data)
depth = per_cpu_ptr(data->cpu_data, iter->cpu)->depth; depth = per_cpu_ptr(data->cpu_data, iter->cpu)->depth;
if (print_graph_prologue(iter, s, 0, 0, flags)) print_graph_prologue(iter, s, 0, 0, flags);
return TRACE_TYPE_PARTIAL_LINE;
/* No time */ /* No time */
ret = print_graph_duration(0, s, flags | FLAGS_FILL_FULL); print_graph_duration(0, s, flags | FLAGS_FILL_FULL);
if (ret != TRACE_TYPE_HANDLED)
return ret;
/* Indentation */ /* Indentation */
if (depth > 0) if (depth > 0)
for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++)
ret = trace_seq_putc(s, ' '); trace_seq_putc(s, ' ');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
/* The comment */ /* The comment */
ret = trace_seq_puts(s, "/* "); trace_seq_puts(s, "/* ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
switch (iter->ent->type) { switch (iter->ent->type) {
case TRACE_BPRINT: case TRACE_BPRINT:
...@@ -1305,11 +1159,9 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, ...@@ -1305,11 +1159,9 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
s->len--; s->len--;
} }
ret = trace_seq_puts(s, " */\n"); trace_seq_puts(s, " */\n");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED; return trace_handle_return(s);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment