From: Vishal Parmar <vishistriker@gmail.com>
To: shuah@kernel.org
Cc: anna-maria@linutronix.de, frederic@kernel.org,
tglx@linutronix.de, jstultz@google.com, sboyd@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Vishal Parmar <vishistriker@gmail.com>
Subject: [PATCH] selftests: timers: improve adjtick output readability
Date: Mon, 28 Jul 2025 21:33:04 +0530 [thread overview]
Message-ID: <20250728160304.929942-1-vishistriker@gmail.com> (raw)
Reformat the output of the `adjtick` test in tools/testing/selftests/timers/
to display results in a clean tabular format.
Previously, the output was printed in a free-form manner like this:
Each iteration takes about 15 seconds
Estimating tick (act: 9000 usec, -100000 ppm): 9000 usec, -100000 ppm [OK]
This format made it hard to visually compare values across iterations or parse
results in scripts.
The new output is aligned in a table with clearly labeled columns:
Each iteration takes about 15 seconds
---------------------------------------------------------------
| Requested (usec) | Expected (ppm) | Measured (ppm) | Result |
|------------------|----------------|----------------|---------|
| 9000 | -100000 | -100001 | [ OK ] |
| 9250 | -75000 | -75000 | [ OK ] |
...
---------------------------------------------------------------
This improves readability, consistency, and log usability for automated tooling.
Signed-off-by: Vishal Parmar <vishistriker@gmail.com>
---
tools/testing/selftests/timers/adjtick.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftests/timers/adjtick.c
index 777d9494b683..b6b3de04d6ae 100644
--- a/tools/testing/selftests/timers/adjtick.c
+++ b/tools/testing/selftests/timers/adjtick.c
@@ -128,18 +128,18 @@ int check_tick_adj(long tickval)
sleep(1);
ppm = ((long long)tickval * MILLION)/systick - MILLION;
- printf("Estimating tick (act: %ld usec, %lld ppm): ", tickval, ppm);
+ printf(" | %-16ld | %-14lld |", tickval, ppm);
eppm = get_ppm_drift();
- printf("%lld usec, %lld ppm", systick + (systick * eppm / MILLION), eppm);
+ printf(" %-14lld |", eppm);
fflush(stdout);
tx1.modes = 0;
adjtimex(&tx1);
if (tx1.offset || tx1.freq || tx1.tick != tickval) {
- printf(" [ERROR]\n");
- printf("\tUnexpected adjtimex return values, make sure ntpd is not running.\n");
+ printf(" [ERROR] |\n");
+ printf(" Unexpected adjtimex return values, make sure ntpd is not running.\n");
return -1;
}
@@ -153,10 +153,10 @@ int check_tick_adj(long tickval)
* room for interruptions during the measurement.
*/
if (llabs(eppm - ppm) > 100) {
- printf(" [FAILED]\n");
+ printf(" [FAILED]\n");
return -1;
}
- printf(" [OK]\n");
+ printf(" [ OK ] |\n");
return 0;
}
@@ -175,7 +175,10 @@ int main(int argc, char **argv)
return -1;
}
- printf("Each iteration takes about 15 seconds\n");
+ printf("\n Each iteration takes about 15 seconds\n");
+ printf(" ---------------------------------------------------------------\n");
+ printf(" | Requested (usec) | Expected (ppm) | Measured (ppm) | Result |\n");
+ printf(" |------------------|----------------|----------------|---------|\n");
systick = sysconf(_SC_CLK_TCK);
systick = USEC_PER_SEC/sysconf(_SC_CLK_TCK);
@@ -188,6 +191,7 @@ int main(int argc, char **argv)
break;
}
}
+ printf(" ---------------------------------------------------------------\n");
/* Reset things to zero */
tx1.modes = ADJ_TICK;
--
2.39.5
next reply other threads:[~2025-07-28 16:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 16:03 Vishal Parmar [this message]
2025-07-29 0:33 ` John Stultz
[not found] ` <CAEOVoRwsHdAmn1d_SekD+ddWeUDJCooNsK_wDHxEyvtqkDXQZw@mail.gmail.com>
2025-07-31 13:58 ` Thomas Gleixner
2025-07-31 16:12 ` Vishal Parmar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250728160304.929942-1-vishistriker@gmail.com \
--to=vishistriker@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®