summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-05-22 10:37:56 -0700
committerRandall Spangler <rspangler@chromium.org>2012-05-22 10:37:56 -0700
commit9b44097d2399e8305f9b64f6e66c85acd18744f9 (patch)
treec89d56cdfbe2a732b290434037d76b8492d900af /core
parent15854fa680c57cfd49f30cf265a2a4d4bb67b076 (diff)
downloadchrome-ec-9b44097d2399e8305f9b64f6e66c85acd18744f9.tar.gz
Add support for printing fixed-point numbers
This makes timestamps much easier to read. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9866 TEST=timerinfo, taskinfo, battery commands have fixed-point numbers, and timestamps printed in the log look right. Change-Id: If91c83f725984c8e04bfb7cdcff316d9c3bfe24c
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/task.c16
-rw-r--r--core/cortex-m/timer.c8
2 files changed, 12 insertions, 12 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index d69b607208..3041f431c8 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -492,11 +492,11 @@ void mutex_unlock(struct mutex *mtx)
void task_print_list(void)
{
int i;
- ccputs("Task Ready Name Events Time (us)\n");
+ ccputs("Task Ready Name Events Time (s)\n");
for (i = 0; i < TASK_ID_COUNT; i++) {
char is_ready = (tasks_ready & (1<<i)) ? 'R' : ' ';
- ccprintf("%4d %c %-16s %08x %10ld\n", i, is_ready,
+ ccprintf("%4d %c %-16s %08x %11.6ld\n", i, is_ready,
task_names[i], tasks[i].events, tasks[i].runtime);
if (in_interrupt_context())
uart_emergency_flush();
@@ -527,13 +527,13 @@ int command_task_info(int argc, char **argv)
total += irq_dist[i];
}
}
- ccprintf("Service calls: %10d\n", svc_calls);
- ccprintf("Total exceptions: %10d\n", total + svc_calls);
- ccprintf("Task switches: %10d\n", task_switches);
- ccprintf("Task switching started: %10ld us\n", task_start_time);
- ccprintf("Time in tasks: %10ld us\n",
+ ccprintf("Service calls: %11d\n", svc_calls);
+ ccprintf("Total exceptions: %11d\n", total + svc_calls);
+ ccprintf("Task switches: %11d\n", task_switches);
+ ccprintf("Task switching started: %11.6ld s\n", task_start_time);
+ ccprintf("Time in tasks: %11.6ld s\n",
get_time().val - task_start_time);
- ccprintf("Time in exceptions: %10ld us\n", exc_total_time);
+ ccprintf("Time in exceptions: %11.6ld s\n", exc_total_time);
#endif
return EC_SUCCESS;
diff --git a/core/cortex-m/timer.c b/core/cortex-m/timer.c
index be2d0d416c..2ea927d4be 100644
--- a/core/cortex-m/timer.c
+++ b/core/cortex-m/timer.c
@@ -170,14 +170,14 @@ void timer_print_info(void)
int tskid;
ccprintf("Time: 0x%016lx us\n"
- "Deadline: 0x%016lx -> %10ld us from now\n"
+ "Deadline: 0x%016lx -> %11.6ld s from now\n"
"Active timers:\n",
t, deadline, deadline - t);
for (tskid = 0; tskid < TASK_ID_COUNT; tskid++) {
if (timer_running & (1<<tskid)) {
- ccprintf(" Tsk %2d 0x%016lx -> %10ld %x\n", tskid,
+ ccprintf(" Tsk %2d 0x%016lx -> %11.6ld\n", tskid,
timer_deadline[tskid].val,
- timer_deadline[tskid].val - t, 0xabcd);
+ timer_deadline[tskid].val - t);
if (in_interrupt_context())
uart_emergency_flush();
else
@@ -202,7 +202,7 @@ DECLARE_CONSOLE_COMMAND(waitms, command_wait);
static int command_get_time(int argc, char **argv)
{
timestamp_t ts = get_time();
- ccprintf("Time: 0x%016lx = %ld us\n", ts.val, ts.val);
+ ccprintf("Time: 0x%016lx = %.6ld s\n", ts.val, ts.val);
return EC_SUCCESS;
}