summaryrefslogtreecommitdiff
path: root/include/bootstage.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-04-07 10:14:41 -0700
committerSimon Glass <sjg@chromium.org>2011-08-24 09:56:21 -0700
commit9530dc99ee3539909935e8a60a2bb756499c8318 (patch)
tree9e67946a7e123dfa8a65c97629a726dcbd80e591 /include/bootstage.h
parent29897caccd59d51e110475edbaa483175f1f363f (diff)
Add microsecond boot time measurement
This defines the basics of a new boot time measurement feature. This allows logging of very accurate time measurements as the boot proceeds, by using an available microsecond counter. To enable the feature, define CONFIG_BOOTSTAGE in your board config file. Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be printed just before handing off to the OS. BUG=chromium-os:13875 TEST=build and boot, check that progress is reported before running Linux: Timer summary in microseconds: Mark Elapsed Stage 0 0 awake 2,181,078 2,181,078 usb_start 11,861,817 9,680,739 bootp_start 11,884,610 22,793 bootp_stop 11,884,689 79 tftp start 15,271,536 3,386,847 tftp done 15,271,568 32 bootm_start 15,406,551 134,983 start_kernel Change-Id: I71b89c8402dc5dec75e68333bd24a6bab7500a1b Reviewed-on: http://gerrit.chromium.org/gerrit/197 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/bootstage.h')
-rw-r--r--include/bootstage.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/include/bootstage.h b/include/bootstage.h
new file mode 100644
index 0000000000..ade5a13999
--- /dev/null
+++ b/include/bootstage.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOOTSTAGE_H
+#define __BOOTSTAGE_H
+
+/*
+ * These are the things that can be timestamped. There are some pre-defined
+ * by U-Boot, and some which are user defined.
+ */
+enum bootstage_id {
+ BOOTSTAGE_AWAKE,
+ BOOTSTAGE_START_UBOOT,
+ BOOTSTAGE_USB_START,
+ BOOTSTAGE_ETH_START,
+ BOOTSTAGE_BOOTP_START,
+ BOOTSTAGE_BOOTP_STOP,
+ BOOTSTAGE_KERNELREAD_START,
+ BOOTSTAGE_KERNELREAD_STOP,
+ BOOTSTAGE_BOOTM_START,
+ BOOTSTAGE_BOOTM_HANDOFF,
+
+ /* a few spare for the user, from here */
+ BOOTSTAGE_USER,
+
+ /*
+ * Total number of entries - increase this at the cost of some BSS
+ * and ATAG space.
+ */
+ BOOTSTAGE_COUNT = 10
+};
+
+#ifdef CONFIG_BOOTSTAGE
+
+/*
+ * Mark a time stamp for the current boot stage.
+ */
+uint32_t bootstage_mark(enum bootstage_id id, const char *name);
+
+/* Print a report about boot time */
+void bootstage_report(void);
+
+#else
+
+static inline bootstage_mark(enum bootstage_id id, const char *name)
+{}
+
+#endif
+
+#endif
+