Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116668
b: refs/heads/master
c: cb5ab74
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Oct 14, 2008
1 parent ba327c1 commit 93d86b8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 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: 77ae11f63befb7fc41ec256f1fcb72ca7e4160d5
refs/heads/master: cb5ab74204a6e2579d1119bf1348eb806526b12b
2 changes: 2 additions & 0 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ struct boot_trace {
initcall_t func;
int result;
unsigned long long duration;
ktime_t calltime;
ktime_t rettime;
};

#ifdef CONFIG_BOOT_TRACER
Expand Down
20 changes: 9 additions & 11 deletions trunk/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,34 +706,32 @@ __setup("initcall_debug", initcall_debug_setup);
int do_one_initcall(initcall_t fn)
{
int count = preempt_count();
ktime_t t0, t1, delta;
ktime_t delta;
char msgbuf[64];
int result;
struct boot_trace it;

if (initcall_debug) {
it.caller = task_pid_nr(current);
it.func = fn;
printk("calling %pF @ %i\n", fn, it.caller);
t0 = ktime_get();
it.calltime = ktime_get();
}

result = fn();
it.result = fn();

if (initcall_debug) {
t1 = ktime_get();
delta = ktime_sub(t1, t0);
it.result = result;
it.rettime = ktime_get();
delta = ktime_sub(it.rettime, it.calltime);
it.duration = (unsigned long long) delta.tv64 >> 20;
printk("initcall %pF returned %d after %Ld msecs\n", fn,
result, it.duration);
it.result, it.duration);
trace_boot(&it);
}

msgbuf[0] = 0;

if (result && result != -ENODEV && initcall_debug)
sprintf(msgbuf, "error code %d ", result);
if (it.result && it.result != -ENODEV && initcall_debug)
sprintf(msgbuf, "error code %d ", it.result);

if (preempt_count() != count) {
strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
Expand All @@ -747,7 +745,7 @@ int do_one_initcall(initcall_t fn)
printk("initcall %pF returned with %s\n", fn, msgbuf);
}

return result;
return it.result;
}


Expand Down
22 changes: 15 additions & 7 deletions trunk/kernel/trace/trace_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,24 @@ static enum print_line_t initcall_print_line(struct trace_iterator *iter)
struct trace_boot *field = (struct trace_boot *)entry;
struct boot_trace *it = &field->initcall;
struct trace_seq *s = &iter->seq;
struct timespec calltime = ktime_to_timespec(it->calltime);
struct timespec rettime = ktime_to_timespec(it->rettime);

if (entry->type == TRACE_BOOT) {
ret = trace_seq_printf(s, "%pF called from %i "
"returned %d after %lld msecs\n",
it->func, it->caller, it->result,
it->duration);
if (ret)
return TRACE_TYPE_HANDLED;
else
ret = trace_seq_printf(s, "[%5ld.%06ld] calling %pF @ %i\n",
calltime.tv_sec,
calltime.tv_nsec,
it->func, it->caller);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_printf(s, "[%5ld.%06ld] initcall %pF "
"returned %d after %lld msecs\n",
rettime.tv_sec,
rettime.tv_nsec,
it->func, it->result, it->duration);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED;
}
return TRACE_TYPE_UNHANDLED;
}
Expand Down

0 comments on commit 93d86b8

Please sign in to comment.