Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257103
b: refs/heads/master
c: ffeb80f
h: refs/heads/master
i:
  257101: 0f35402
  257099: 7ef0ade
  257095: fa0e4d4
  257087: f4a6645
v: v3
  • Loading branch information
Jiri Olsa authored and Steven Rostedt committed Jun 15, 2011
1 parent 9c36c60 commit 3bc7e4c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 321e68b095addc473ca52ced9acfa59be88f76e6
refs/heads/master: ffeb80fc30acbf6bd51cb47a1815f621a9d017dc
148 changes: 74 additions & 74 deletions trunk/kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ static struct tracer_flags tracer_flags = {

static struct trace_array *graph_array;

/*
* DURATION column is being also used to display IRQ signs,
* following values are used by print_graph_irq and others
* to fill in space into DURATION column.
*/
enum {
DURATION_FILL_FULL = -1,
DURATION_FILL_START = -2,
DURATION_FILL_END = -3,
};

static enum print_line_t
print_graph_duration(unsigned long long duration, struct trace_seq *s,
u32 flags);

/* Add a function return address to the trace stack on thread info.*/
int
Expand Down Expand Up @@ -577,32 +591,6 @@ get_return_for_leaf(struct trace_iterator *iter,
return next;
}

/* Signal a overhead of time execution to the output */
static int
print_graph_overhead(unsigned long long duration, struct trace_seq *s,
u32 flags)
{
/* If duration disappear, we don't need anything */
if (!(flags & TRACE_GRAPH_PRINT_DURATION))
return 1;

/* Non nested entry or return */
if (duration == -1)
return trace_seq_printf(s, " ");

if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
/* Duration exceeded 100 msecs */
if (duration > 100000ULL)
return trace_seq_printf(s, "! ");

/* Duration exceeded 10 msecs */
if (duration > 10000ULL)
return trace_seq_printf(s, "+ ");
}

return trace_seq_printf(s, " ");
}

static int print_graph_abs_time(u64 t, struct trace_seq *s)
{
unsigned long usecs_rem;
Expand Down Expand Up @@ -650,9 +638,9 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
}

/* No overhead */
ret = print_graph_overhead(-1, s, flags);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
ret = print_graph_duration(DURATION_FILL_START, s, flags);
if (ret != TRACE_TYPE_HANDLED)
return ret;

if (type == TRACE_GRAPH_ENT)
ret = trace_seq_printf(s, "==========>");
Expand All @@ -662,9 +650,10 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

/* Don't close the duration column if haven't one */
if (flags & TRACE_GRAPH_PRINT_DURATION)
trace_seq_printf(s, " |");
ret = print_graph_duration(DURATION_FILL_END, s, flags);
if (ret != TRACE_TYPE_HANDLED)
return ret;

ret = trace_seq_printf(s, "\n");

if (!ret)
Expand Down Expand Up @@ -716,9 +705,48 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
}

static enum print_line_t
print_graph_duration(unsigned long long duration, struct trace_seq *s)
print_graph_duration(unsigned long long duration, struct trace_seq *s,
u32 flags)
{
int ret;
int ret = -1;

if (!(flags & TRACE_GRAPH_PRINT_DURATION))
return TRACE_TYPE_HANDLED;

/* No real adata, just filling the column with spaces */
switch (duration) {
case DURATION_FILL_FULL:
ret = trace_seq_printf(s, " | ");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
case DURATION_FILL_START:
ret = trace_seq_printf(s, " ");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
case DURATION_FILL_END:
ret = trace_seq_printf(s, " |");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
}

/* Signal a overhead of time execution to the output */
if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
/* Duration exceeded 100 msecs */
if (duration > 100000ULL)
ret = trace_seq_printf(s, "! ");
/* Duration exceeded 10 msecs */
else if (duration > 10000ULL)
ret = trace_seq_printf(s, "+ ");
}

/*
* The -1 means we either did not exceed the duration tresholds
* or we dont want to print out the overhead. Either way we need
* to fill out the space.
*/
if (ret == -1)
ret = trace_seq_printf(s, " ");

/* Catching here any failure happenned above */
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

ret = trace_print_graph_duration(duration, s);
if (ret != TRACE_TYPE_HANDLED)
Expand Down Expand Up @@ -767,18 +795,11 @@ print_graph_entry_leaf(struct trace_iterator *iter,
cpu_data->enter_funcs[call->depth] = 0;
}

/* Overhead */
ret = print_graph_overhead(duration, s, flags);
if (!ret)
/* Overhead and duration */
ret = print_graph_duration(duration, s, flags);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;

/* Duration */
if (flags & TRACE_GRAPH_PRINT_DURATION) {
ret = print_graph_duration(duration, s);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}

/* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
ret = trace_seq_printf(s, " ");
Expand Down Expand Up @@ -815,17 +836,10 @@ print_graph_entry_nested(struct trace_iterator *iter,
cpu_data->enter_funcs[call->depth] = call->func;
}

/* No overhead */
ret = print_graph_overhead(-1, s, flags);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

/* No time */
if (flags & TRACE_GRAPH_PRINT_DURATION) {
ret = trace_seq_printf(s, " | ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
ret = print_graph_duration(DURATION_FILL_FULL, s, flags);
if (ret != TRACE_TYPE_HANDLED)
return ret;

/* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
Expand Down Expand Up @@ -1078,18 +1092,11 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
if (print_graph_prologue(iter, s, 0, 0, flags))
return TRACE_TYPE_PARTIAL_LINE;

/* Overhead */
ret = print_graph_overhead(duration, s, flags);
if (!ret)
/* Overhead and duration */
ret = print_graph_duration(duration, s, flags);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;

/* Duration */
if (flags & TRACE_GRAPH_PRINT_DURATION) {
ret = print_graph_duration(duration, s);
if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE;
}

/* Closing brace */
for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) {
ret = trace_seq_printf(s, " ");
Expand Down Expand Up @@ -1146,17 +1153,10 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
if (print_graph_prologue(iter, s, 0, 0, flags))
return TRACE_TYPE_PARTIAL_LINE;

/* No overhead */
ret = print_graph_overhead(-1, s, flags);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

/* No time */
if (flags & TRACE_GRAPH_PRINT_DURATION) {
ret = trace_seq_printf(s, " | ");
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
}
ret = print_graph_duration(DURATION_FILL_FULL, s, flags);
if (ret != TRACE_TYPE_HANDLED)
return ret;

/* Indentation */
if (depth > 0)
Expand Down

0 comments on commit 3bc7e4c

Please sign in to comment.