summaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-11-02 09:50:17 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-11-04 09:54:23 +0100
commit40d31b8e45421ed1fb6906a9fe2fca1d75f6b6ef (patch)
treef14158a70252ecfa15ba2431b058b63ee253c8f4 /commands
parentd4204476ccf8318abacd7996a48e2fa0d87fe2d4 (diff)
downloadbarebox-40d31b8e45421ed1fb6906a9fe2fca1d75f6b6ef.tar.gz
commands: uptime: add note about caveats
Normally timer overrun is not that much of a problem, because there where it matters, we usually have an is_timeout() in the loop that reads the timer often enough. This doesn't necessarily hold for the new uptime command and basically anything can happen between subsequent calls and if get_time_ns() is not called often enough during that time, we end up with an inaccurate uptime. Mention this in the extended help text. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221102085017.1941580-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/uptime.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/commands/uptime.c b/commands/uptime.c
index a9a8c650b6..d67538631c 100644
--- a/commands/uptime.c
+++ b/commands/uptime.c
@@ -66,6 +66,9 @@ static int do_uptime(int argc, char *argv[])
BAREBOX_CMD_HELP_START(uptime)
BAREBOX_CMD_HELP_TEXT("This command formats the number of elapsed nanoseconds")
BAREBOX_CMD_HELP_TEXT("as measured with the current clocksource")
+BAREBOX_CMD_HELP_TEXT("Note: Timekeeping is co-operative. If long running code does")
+BAREBOX_CMD_HELP_TEXT("not use delay/is_timeout/get_time_ns/getchar functions")
+BAREBOX_CMD_HELP_TEXT("timer may overrun resulting in incorrect results")
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-n", "output elapsed time in nanoseconds")
BAREBOX_CMD_HELP_END