summaryrefslogtreecommitdiff
path: root/common/hooks.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-05-19 15:03:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:32:17 +0000
commitffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch)
tree362dd0ba205731aa07be97dd35b44b237799b23b /common/hooks.c
parent478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff)
downloadchrome-ec-ffac23c0ea1bd4ff4568f5bd709a98f912b833a7.tar.gz
Add cprints() and ccprints()
Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/hooks.c')
-rw-r--r--common/hooks.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/hooks.c b/common/hooks.c
index b7086a866b..f95d531947 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -14,10 +14,10 @@
#ifdef CONFIG_HOOK_DEBUG
#define CPUTS(outstr) cputs(CC_HOOK, outstr)
-#define CPRINTF(format, args...) cprintf(CC_HOOK, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_HOOK, format, ## args)
#else
#define CPUTS(outstr)
-#define CPRINTF(format, args...)
+#define CPRINTS(format, args...)
#endif
#define DEFERRED_FUNCS_COUNT (__deferred_funcs_end - __deferred_funcs)
@@ -83,7 +83,7 @@ static void record_hook_delay(uint64_t now, uint64_t last, uint64_t interval,
/* Warn if delayed by more than 10% */
if (delayed * 10 > interval)
- CPRINTF("[%T Hook at interval %d us delayed by %d us]\n",
+ CPRINTS("Hook at interval %d us delayed by %d us",
(uint32_t)interval, (uint32_t)delayed);
}
#endif
@@ -98,7 +98,7 @@ void hook_notify(enum hook_type type)
uint64_t run_time;
#endif
- CPRINTF("[%T hook notify %d]\n", type);
+ CPRINTS("hook notify %d", type);
start = hook_list[type].start;
end = hook_list[type].end;
@@ -187,7 +187,7 @@ void hook_task(void)
/* Handle deferred routines */
for (i = 0; i < DEFERRED_FUNCS_COUNT; i++) {
if (defer_until[i] && defer_until[i] < t) {
- CPRINTF("[%T hook call deferred 0x%p]\n",
+ CPRINTS("hook call deferred 0x%p",
__deferred_funcs[i].routine);
/*
* Call deferred function. Clear timer first,