summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-12-20 10:39:07 -0800
committerSimon Glass <sjg@chromium.org>2012-01-05 19:19:05 -0800
commit86e63e0fe2ed12a5e2dcb0c8b3e4b6f074de558f (patch)
tree8b7ce2cc8524d351c9d647874f6d0ec10d0f6009 /include
parenta7f64ee81c0b4701a0286be4ea8cd5e0474b5f9c (diff)
Add bootstage accumulation
This adds a new type of boot timer, which records the time taken by an operation, rather than marking the instant when it occurred. This is useful to track the amount of time spent in a repeating activity during boot. To use this, call bootstage_start() at the start of the activity, then bootstage_accum() at the end, to add this segment of time to the total. You can call them (start first, then accum) as many times as you like. BUG=chromium-os:22938 TEST=build and boot on Kaen Change-Id: I3f1b536dc140c91a4a780188f6974dc37780f4f0 Reviewed-on: https://gerrit.chromium.org/gerrit/13370 Commit-Ready: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/bootstage.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/bootstage.h b/include/bootstage.h
index bed488f76f..5ae5d1d712 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -58,11 +58,43 @@ enum bootstage_id {
#ifdef CONFIG_BOOTSTAGE
-/*
+/**
* Mark a time stamp for the current boot stage.
+ *
+ * @param id Bootstage id to record this timestamp against
+ * @param name Textual name to display for this id in the report (maybe NULL)
+ * @return recorded timestamp in microseconds
*/
uint32_t bootstage_mark(enum bootstage_id id, const char *name);
+/**
+ * Mark the start of a bootstage activity. The end will be marked later with
+ * bootstage_accum() and at that point we accumulate the time taken. Calling
+ * this function turns the given id into a accumulator rather than and
+ * absolute mark in time. Accumulators record the total amount of time spent
+ * in an activty during boot.
+ *
+ * @param id Bootstage id to record this timestamp against
+ * @param name Textual name to display for this id in the report (maybe NULL)
+ * @return start timestamp in microseconds
+ */
+uint32_t bootstage_start(enum bootstage_id id, const char *name);
+
+/**
+ * Mark the start of a bootstage activity. The end will be marked later with
+ * bootstage_accum() and at that point we accumulate the time taken. Calling
+ * this function turns the given id into a accumulator rather than and
+ * absolute mark in time. Accumulators record the total amount of time spent
+ * in an activty during boot.
+ *
+ * @param id Bootstage id to record this timestamp against
+ * @param name Textual name to display for this id in the report (maybe NULL)
+ * @return time spent in this iteration of the activity (i.e. the time now
+ * less the start time recorded in the last bootstage_start() call
+ * with this id.
+ */
+uint32_t bootstage_accum(enum bootstage_id id);
+
/* Print a report about boot time */
void bootstage_report(void);