From 052942923b2320ee9cb2a1bcc2d2689c179ad4f5 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 30 Apr 2013 15:41:13 -0500 Subject: device tree: track init times With the introduction of a monotonic timer it is possible to track the individual times of each device's init() call. Add this ability behind a HAVE_MONOTONIC_TIMER option. Example log messages: Root Device init 5 usecs CPU_CLUSTER: 0 init 66004 usecs PCI: 00:00.0 init 1020 usecs PCI: 00:02.0 init 456941 usecs PCI: 00:13.0 init 3 usecs PCI: 00:14.0 init 3 usecs PCI: 00:15.0 init 92 usecs PCI: 00:15.1 init 37 usecs PCI: 00:15.2 init 36 usecs PCI: 00:15.3 init 35 usecs PCI: 00:15.4 init 35 usecs PCI: 00:15.5 init 36 usecs PCI: 00:15.6 init 35 usecs PCI: 00:16.0 init 3666 usecs PCI: 00:17.0 init 63 usecs PCI: 00:1b.0 init 3 usecs PCI: 00:1c.0 init 89 usecs PCI: 00:1c.1 init 15 usecs PCI: 00:1c.2 init 15 usecs PCI: 00:1c.3 init 15 usecs PCI: 00:1c.4 init 15 usecs PCI: 00:1c.5 init 16 usecs PCI: 00:1d.0 init 4 usecs PCI: 00:1f.0 init 495 usecs PCI: 00:1f.2 init 29 usecs PCI: 00:1f.3 init 4 usecs PCI: 00:1f.6 init 4 usecs Change-Id: Ibe499848432c7ab20166ab10d6dfb07db03eab01 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/3162 Reviewed-by: Ronald G. Minnich Tested-by: build bot (Jenkins) --- src/device/device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/device/device.c') diff --git a/src/device/device.c b/src/device/device.c index e0c8bf0523..a971270eba 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -43,6 +43,7 @@ #if CONFIG_ARCH_X86 #include #endif +#include /** Linked list of ALL devices */ struct device *all_devices = &dev_root; @@ -1103,6 +1104,12 @@ static void init_dev(struct device *dev) return; if (!dev->initialized && dev->ops && dev->ops->init) { +#if CONFIG_HAVE_MONOTONIC_TIMER + struct mono_time start_time; + struct rela_time dev_init_time; + + timer_monotonic_get(&start_time); +#endif if (dev->path.type == DEVICE_PATH_I2C) { printk(BIOS_DEBUG, "smbus: %s[%d]->", dev_path(dev->bus->dev), dev->bus->link_num); @@ -1111,6 +1118,11 @@ static void init_dev(struct device *dev) printk(BIOS_DEBUG, "%s init\n", dev_path(dev)); dev->initialized = 1; dev->ops->init(dev); +#if CONFIG_HAVE_MONOTONIC_TIMER + dev_init_time = current_time_from(&start_time); + printk(BIOS_DEBUG, "%s init %ld usecs\n", dev_path(dev), + rela_time_in_microseconds(&dev_init_time)); +#endif } } -- cgit v1.2.3