[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250728160304.929942-1-vishistriker@gmail.com>
Date: Mon, 28 Jul 2025 21:33:04 +0530
From: Vishal Parmar <vishistriker@...il.com>
To: shuah@...nel.org
Cc: anna-maria@...utronix.de,
frederic@...nel.org,
tglx@...utronix.de,
jstultz@...gle.com,
sboyd@...nel.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Vishal Parmar <vishistriker@...il.com>
Subject: [PATCH] selftests: timers: improve adjtick output readability
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@...il.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
Powered by blists - more mailing lists