diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2011-06-21 00:57:08 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2011-06-21 00:57:08 +0200 |
commit | fa45333391cae255e5d9c9da72ebc0fd81a56ea0 (patch) | |
tree | 1ae3636f5c7bd25e25a103b0e39641c85be5e16c /clocks.c | |
parent | 0a8cc5880b9ba3fa8ef257329017f9d6d81e35b5 (diff) | |
download | powerdebug-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.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -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); |