diff options
author | Amit Arora <amit.arora@linaro.org> | 2010-10-07 14:09:17 +0530 |
---|---|---|
committer | Amit Arora <amit.arora@linaro.org> | 2010-10-07 14:09:17 +0530 |
commit | 67b03314155db2dd264e48ade570dcc3e6fd6236 (patch) | |
tree | 34334c58554ddc970ecf3f5f935e9e5758f16beb | |
parent | bf50db9c8663d31b7c84bb9cf1595ce88b068fc6 (diff) |
Show units for clock rate
-rw-r--r-- | display.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -277,8 +277,21 @@ void print_clock_info_line(int line, char *clockname, int flags, int rate, print(clock_win, 0, line + 1, "%s", clockname); if (strcmp(clockname, "..")) { + double drate = 0.0; + char unit[8]; + print(clock_win, 48, line + 1, "%d", flags); - print(clock_win, 60, line + 1, "%d", rate); + if (rate > 1000 && rate < 1000000) { + drate = (double)rate/1000.0; + strcpy(unit, "KHz"); + } else if (rate > 1000000) { + drate = (double)rate/1000000.0; + strcpy(unit, "MHz"); + } else { + drate = (double)rate; + strcpy(unit, " Hz"); + } + print(clock_win, 60, line + 1, "%6.2f %s", drate, unit); print(clock_win, 72, line + 1, "%d", usecount); } |