aboutsummaryrefslogtreecommitdiff
path: root/clocks.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
commitfa45333391cae255e5d9c9da72ebc0fd81a56ea0 (patch)
tree1ae3636f5c7bd25e25a103b0e39641c85be5e16c /clocks.c
parent0a8cc5880b9ba3fa8ef257329017f9d6d81e35b5 (diff)
downloadpowerdebug-fa45333391cae255e5d9c9da72ebc0fd81a56ea0.tar.gz
Factor out display code
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'clocks.c')
-rw-r--r--clocks.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/clocks.c b/clocks.c
index 684bf88..411fcb2 100644
--- a/clocks.c
+++ b/clocks.c
@@ -286,14 +286,30 @@ static int clock_print_info_cb(struct tree *t, void *data)
return 0;
}
+static int clock_print_header(void)
+{
+ char *buf;
+ int ret;
+
+ if (asprintf(&buf, "%-55s %-16s %-12s %-9s %-8s",
+ "Name", "Flags", "Rate", "Usecount", "Children") < 0)
+ return -1;
+
+ ret = display_header_footer(CLOCK, buf);
+
+ free(buf);
+
+ return ret;
+}
+
static int clock_print_info(void)
{
int ret, line = 0;
- print_clock_header();
-
display_reset_cursor(CLOCK);
+ clock_print_header();
+
ret = tree_for_each(clock_tree, clock_print_info_cb, &line);
display_refresh_pad(CLOCK);