diff options
author | Amit Arora <amit.arora@linaro.org> | 2010-11-16 11:28:57 +0530 |
---|---|---|
committer | Amit Arora <amit.arora@linaro.org> | 2010-11-16 11:28:57 +0530 |
commit | 04f977447f757695cc211811010e93c0c5633eb9 (patch) | |
tree | 386f2eb96af751fb465e529225572e32f920ca30 | |
parent | 3bc8c920b5fb4438ffff9d08b63979c82b84fbe9 (diff) |
If unable to read clock tree, inform user
-rw-r--r-- | clocks.c | 22 | ||||
-rw-r--r-- | clocks.h | 2 | ||||
-rw-r--r-- | display.c | 2 | ||||
-rw-r--r-- | powerdebug.c | 11 | ||||
-rw-r--r-- | powerdebug.h | 2 |
5 files changed, 24 insertions, 15 deletions
@@ -21,27 +21,33 @@ static char clk_dir_path[PATH_MAX]; static char clk_name[NAME_MAX]; static int bold[MAX_LINES]; -void init_clock_details(void) +int init_clock_details(void) { char *path = debugfs_locate_mpoint(); struct stat buf; - if (path) strcpy(clk_dir_path, path); else { - fprintf(stderr, "powerdebug: Unable to locate debugfs mount" - " point. Mount debugfs and try again..\n"); - exit(1); + create_selectedwindow(); + sprintf(clock_lines[0], "Unable to locate debugfs mount point." + " Mount debugfs and try again..\n"); + print_one_clock(0, clock_lines[0], 1, 0); + old_clock_line_no = 1; + return(1); } sprintf(clk_dir_path, "%s/clock", clk_dir_path); strcpy(clk_dir_path, "/debug/clock"); // Hardcoded for testing.. if (stat(clk_dir_path, &buf)) { - fprintf(stderr, "powerdebug: Unable to find clock tree" - " information at %s. Exiting..\n", clk_dir_path); - exit(1); + create_selectedwindow(); + sprintf(clock_lines[0], "Unable to find clock tree" + " information at %s.\n", clk_dir_path); + print_one_clock(0, clock_lines[0], 1, 0); + old_clock_line_no = 1; + return(1); } strcpy(clk_name, ""); + return(0); } int get_int_from(char *file) @@ -22,7 +22,7 @@ extern int maxy; -#define MAX_LINES 80 +#define MAX_LINES 120 struct clock_info { char name[NAME_MAX]; @@ -228,7 +228,7 @@ void print_clock_header(void) print(clock_win, 54, 0, "Flags"); print(clock_win, 64, 0, "Rate"); print(clock_win, 72, 0, "Usecount"); - print(clock_win, 84, 0, "ChildCount"); + print(clock_win, 84, 0, "Children"); wattroff(clock_win, A_BOLD); wrefresh(clock_win); } diff --git a/powerdebug.c b/powerdebug.c index 7fc1f14..72faa02 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -325,11 +325,13 @@ int main(int argc, char **argv) } if (selectedwindow == CLOCK) { + int ret = 0; if (firsttime[CLOCK]) { - init_clock_details(); - firsttime[CLOCK] = 0; + ret = init_clock_details(); + if (!ret) + firsttime[CLOCK] = 0; } - if (!dump) { + if (!ret && !dump) { int hrow; create_selectedwindow(); @@ -338,7 +340,8 @@ int main(int argc, char **argv) enter_hit); highlighted_row = hrow; enter_hit = 0; - } else + } + if (!ret && dump) read_and_dump_clock_info(verbose); } diff --git a/powerdebug.h b/powerdebug.h index 4ed450d..75171b0 100644 --- a/powerdebug.h +++ b/powerdebug.h @@ -65,7 +65,7 @@ extern int read_and_print_clock_info(int verbose, int hrow, int selected); extern void print_clock_info(int verbose, int hrow, int selected); extern void get_sensor_info(char *path, char *name, char *sensor, int verbose); extern void print_string_val(char *name, char *val); -extern void init_clock_details(void); +extern int init_clock_details(void); extern void print_clock_header(void); extern void print_sensor_header(void); extern void print_one_clock(int line, char *str, int bold, int highlight); |