Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: firmware/include/utility.h

Issue 3446025: Add performance macros; fix assert macro (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git
Patch Set: Fix missing #ifdef around assert macro Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/include/utility.h
diff --git a/firmware/include/utility.h b/firmware/include/utility.h
index a412fd8251771b50588d0dc4fe618351e9acd4cf..3c4a3bb5017b3c3d45c9d71c130118c649e62835 100644
--- a/firmware/include/utility.h
+++ b/firmware/include/utility.h
@@ -19,15 +19,35 @@
#define VBDEBUG(params)
#endif
+#ifndef VBOOT_PERFORMANCE
+/* Define performance macros as nothing. If you enable VBOOT_PERFORMANCE,
+ * you must define these macros in your platform's biosincludes.h.
+ *
+ * Intended usage for using a performance counter called 'foo':
+ *
+ * VBPERFSTART("foo")
+ * ...code to be tested...
+ * VBPERFEND("foo")
+ *
+ * Names should be <= 8 characters to be compatible with all platforms.
+ */
+#define VBPERFSTART(name)
+#define VBPERFEND(name)
+#endif
+
/* Outputs an error message and quits. */
-void error(const char *format, ...);
+void error(const char* format, ...);
/* Outputs debug/warning messages. */
-void debug(const char *format, ...);
+void debug(const char* format, ...);
+#ifdef VBOOT_DEBUG
#define assert(expr) do { if (!(expr)) { \
error("assert fail: %s at %s:%d\n", \
#expr, __FILE__, __LINE__); }} while(0)
+#else
+#define assert(expr)
+#endif
/* Combine [msw] and [lsw] uint16s to a uint32_t with its [msw] and
* [lsw] forming the most and least signficant 16-bit words.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698