Prints out how long it takes to generate each section.
It's done using a DurationReporter helper class that prints starts
counting when constructed and prints the duration when destructed.
Typical usage:
function do_something() {
DurationReporter duration_reporter(title);
// Do something.
}
Change-Id: I87134d9a1b003300384376c242a3c034a46244c4
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index df9721d..1719090 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -142,11 +142,32 @@
/* Takes a screenshot and save it to the given file */
void take_screenshot(const std::string& path);
+/* dump eMMC Extended CSD data */
+void dump_emmc_ecsd(const char *ext_csd_path);
+
+/*
+ * Helper class used to report how long it takes for a section to finish.
+ *
+ * Typical usage:
+ *
+ * DurationReporter duration_reporter(title);
+ *
+ */
+class DurationReporter {
+public:
+ DurationReporter(const char *title);
+
+ ~DurationReporter();
+
+ static uint64_t nanotime();
+
+private:
+ const char* title_;
+ uint64_t started_;
+};
+
#ifdef __cplusplus
}
#endif
-/* dump eMMC Extended CSD data */
-void dump_emmc_ecsd(const char *ext_csd_path);
-
#endif /* _DUMPSTATE_H_ */