oslat: correct spelling of Mhz to MHz

oslat: Fix conversion to nanoseconds for 1us bucket
Resolves: RHEL-23909
Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
John Kacur 2024-02-05 12:22:30 -05:00
parent 16571e3daa
commit 62d150d0fa
3 changed files with 84 additions and 1 deletions

View File

@ -6,7 +6,7 @@ Name: realtime-tests
# Numa argument to make: NUMA=1
#
Version: 2.6
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2
URL: https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
Source0: https://www.kernel.org/pub/linux/utils/rt-tests/rt-tests-%{version}.tar.xz
@ -30,6 +30,8 @@ Patch7: rt-tests-cyclicdeadline-Add-histogram-support.patch
Patch8: rt-tests-cyclics-Fix-json-segfault-when-not-using-hi.patch
Patch9: rt-tests-cyclicdeadline-Print-the-histogram-regardle.patch
Patch10: rt-tests-cyclicdeadline-Remove-dead-verbose-code-in-.patch
Patch11: rt-tests-oslat-should-use-MHz-not-Mhz.patch
Patch12: rt-tests-oslat-convert-to-nanoseconds-correctly.patch
%description
realtime-tests is a set of programs that test and measure various components of
@ -98,6 +100,11 @@ latency. It also tests the functioning of priority-inheritance mutexes.
%{_mandir}/man8/determine_maximum_mpps.8.*
%changelog
* Mon Feb 05 2024 John Kacur <jkacur@redhat.com> - 2.6-4
- oslat: correct spelling of Mhz to MHz
- oslat: Fix conversion to nanoseconds for 1us bucket
Resolves: RHEL-23909
* Fri Jan 26 2024 Crystal Wood <crwood@redhat.com> - 2.6-3
- Fix issues with with using --json without --histogram (both cyclictest and
cyclicdeadline), and using --histogram without --quiet in cyclicdeadline.

View File

@ -0,0 +1,42 @@
From 4aeacf722cee26a3f88ab7f631c9ab9ba6ecdb49 Mon Sep 17 00:00:00 2001
From: Marcelo Tosatti <mtosatti@redhat.com>
Date: Thu, 1 Feb 2024 14:50:54 -0300
Subject: [PATCH 2/2] rt-tests: oslat: convert to nanoseconds correctly
With buckets of size 1us, accounting for measurements in the
[1ns, 999ns] range are done to the 2us bucket (while they
should be accounted in the 1us bucket):
001 (us): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
002 (us): 41916187 41937649 41938461 42029055 ...
003 (us): 969 985 958 972 964 986 970 961 973 ...
Fix this by doing a plain cycles -> nanoseconds convertion:
001 (us): 43287555 43086678 43087427 43109974 ...
002 (us): 983 987 985 975 982 960 993 961 992 ...
003 (us): 9 6 7 13 9 22 3 21 3 3 8 8 10 11 3 55
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reported-by: Chuck Newman <chuck.newman@hpe.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/oslat/oslat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index e398f205b40a..0863297f2cf1 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -334,7 +334,7 @@ static void insert_bucket(struct thread *t, stamp_t value)
uint64_t extra;
double us;
- lat = (value * g.unit_per_us + t->counter_mhz - 1) / t->counter_mhz;
+ lat = (value * g.unit_per_us) / t->counter_mhz;
us = (double)lat / g.unit_per_us;
if (!g.preheat && g.trace_threshold && us >= g.trace_threshold) {
char *line = "%s: Trace threshold (%d us) triggered on cpu %d with %.*f us!\n";
--
2.43.0

View File

@ -0,0 +1,34 @@
From 251d082403b371098c8420c01d1b058b12a9cc78 Mon Sep 17 00:00:00 2001
From: Marcelo Tosatti <mtosatti@redhat.com>
Date: Thu, 1 Feb 2024 13:05:38 -0300
Subject: [PATCH 1/2] rt-tests: oslat should use MHz, not Mhz
Usage of Mhz, in oslat, is incorrect:
From https://www.nist.gov/pml/owm/writing-si-metric-system-units#:~:text=NOT%20250%20mms.-,Capitalization,the%20beginning%20of%20the%20sentence:
"When the unit is derived from the name of a person, the symbol or the first letter of the symbol is an uppercase letter (W for the unit "watt" or Pa for the unit "pascal")."
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reported-by: Chuck Newman <chuck.newman@hpe.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/oslat/oslat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 4bdca643da72..e398f205b40a 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -501,7 +501,7 @@ static void write_summary(struct thread *t)
calculate(t);
putfield("Core", t[i].core_i, "d", "");
- putfield("Counter Freq", t[i].counter_mhz, "u", " (Mhz)");
+ putfield("Counter Freq", t[i].counter_mhz, "u", " (MHz)");
for (j = 0; j < g.bucket_size; j++) {
if (j < g.bucket_size-1 && g.output_omit_zero_buckets) {
--
2.43.0