aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-05-08 03:28:26 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:07 -0400
commit8f0c45cdf87dc9141e87b0ad2fc6fff216a95f79 (patch)
tree1940c1f08b9bc6e2429559ba19b71b725ad9524c /init/main.c
parentb73a7e76c1eeaa770a41554698917c3c45686a07 (diff)
enhance initcall_debug, measure latency
enhance the initcall_debug boot option: - measure the time the initcall took to execute and report it in units of milliseconds. - show the return code of initcalls (useful to see failures and to make sure that an initcall hung) [akpm@linux-foundation.org: fix printk warning] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c
index 949c27b59d12..c1537e0ddceb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -648,6 +648,7 @@ static void __init do_initcalls(void)
648 int count = preempt_count(); 648 int count = preempt_count();
649 649
650 for (call = __initcall_start; call < __initcall_end; call++) { 650 for (call = __initcall_start; call < __initcall_end; call++) {
651 ktime_t t0, t1, delta;
651 char *msg = NULL; 652 char *msg = NULL;
652 char msgbuf[40]; 653 char msgbuf[40];
653 int result; 654 int result;
@@ -657,10 +658,26 @@ static void __init do_initcalls(void)
657 print_fn_descriptor_symbol(": %s()", 658 print_fn_descriptor_symbol(": %s()",
658 (unsigned long) *call); 659 (unsigned long) *call);
659 printk("\n"); 660 printk("\n");
661 t0 = ktime_get();
660 } 662 }
661 663
662 result = (*call)(); 664 result = (*call)();
663 665
666 if (initcall_debug) {
667 t1 = ktime_get();
668 delta = ktime_sub(t1, t0);
669
670 printk("initcall 0x%p", *call);
671 print_fn_descriptor_symbol(": %s()",
672 (unsigned long) *call);
673 printk(" returned %d.\n", result);
674
675 printk("initcall 0x%p ran for %Ld msecs: ",
676 *call, (unsigned long long)delta.tv64 >> 20);
677 print_fn_descriptor_symbol("%s()\n",
678 (unsigned long) *call);
679 }
680
664 if (result && result != -ENODEV && initcall_debug) { 681 if (result && result != -ENODEV && initcall_debug) {
665 sprintf(msgbuf, "error code %d", result); 682 sprintf(msgbuf, "error code %d", result);
666 msg = msgbuf; 683 msg = msgbuf;