cyclics histogram bugfixes
Fix issues with using --json without --histogram (both cyclictest and cyclicdeadline), and using --histogram without --quiet in cyclicdeadline. Resolves: RHEL-9910 Signed-off-by: Crystal Wood <crwood@redhat.com>
This commit is contained in:
parent
c89852f80c
commit
16571e3daa
@ -6,7 +6,7 @@ Name: realtime-tests
|
||||
# Numa argument to make: NUMA=1
|
||||
#
|
||||
Version: 2.6
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?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
|
||||
@ -27,6 +27,9 @@ Patch4: rt-tests-Fix-warnings.patch
|
||||
Patch5: rt-tests-cyclictest-Remove-histogram-totals.patch
|
||||
Patch6: rt-tests-cyclictest-Replace-histogram-code-with-libr.patch
|
||||
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
|
||||
|
||||
%description
|
||||
realtime-tests is a set of programs that test and measure various components of
|
||||
@ -42,6 +45,9 @@ latency. It also tests the functioning of priority-inheritance mutexes.
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
|
||||
%build
|
||||
%set_build_flags
|
||||
@ -92,6 +98,11 @@ latency. It also tests the functioning of priority-inheritance mutexes.
|
||||
%{_mandir}/man8/determine_maximum_mpps.8.*
|
||||
|
||||
%changelog
|
||||
* 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.
|
||||
Resolves: RHEL-9910
|
||||
|
||||
* Thu Jan 11 2024 Crystal Wood <crwood@redhat.com> - 2.6-2
|
||||
- cyclicdeadline histogram support
|
||||
Resolves: RHEL-9910
|
||||
|
49
rt-tests-cyclicdeadline-Print-the-histogram-regardle.patch
Normal file
49
rt-tests-cyclicdeadline-Print-the-histogram-regardle.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 8f05671597898ffc9f2f310bbf71e0b9c7b4dec3 Mon Sep 17 00:00:00 2001
|
||||
From: Crystal Wood <crwood@redhat.com>
|
||||
Date: Mon, 22 Jan 2024 16:13:20 -0600
|
||||
Subject: [PATCH 2/3] rt-tests: cyclicdeadline: Print the histogram regardless
|
||||
of quiet
|
||||
|
||||
The histogram printing code should not have been gated by !quiet,
|
||||
even though other summary printing code is.
|
||||
|
||||
The non-histogram output also should not have been gated based on
|
||||
the presence of the histogram.
|
||||
|
||||
Signed-off-by: Crystal Wood <crwood@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
src/sched_deadline/cyclicdeadline.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
|
||||
index b3155547b9bb..3cb8f714b788 100644
|
||||
--- a/src/sched_deadline/cyclicdeadline.c
|
||||
+++ b/src/sched_deadline/cyclicdeadline.c
|
||||
@@ -1117,15 +1117,15 @@ static void loop(struct sched_data *sched_data, int nr_threads)
|
||||
usleep(10000);
|
||||
if (!quiet) {
|
||||
printf("\033[%dB", nr_threads + 2);
|
||||
- } else {
|
||||
- if (histogram) {
|
||||
- FILE *out = histfile ? histfile : stdout;
|
||||
+ } else if (!histogram) {
|
||||
+ for (i = 0; i < nr_threads; ++i)
|
||||
+ print_stat(stdout, &sched_data[i], i, 0, 0);
|
||||
+ }
|
||||
|
||||
- print_hist(out, sched_data, nr_threads);
|
||||
- } else {
|
||||
- for (i = 0; i < nr_threads; ++i)
|
||||
- print_stat(stdout, &sched_data[i], i, 0, 0);
|
||||
- }
|
||||
+ if (histogram) {
|
||||
+ FILE *out = histfile ? histfile : stdout;
|
||||
+
|
||||
+ print_hist(out, sched_data, nr_threads);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
107
rt-tests-cyclicdeadline-Remove-dead-verbose-code-in-.patch
Normal file
107
rt-tests-cyclicdeadline-Remove-dead-verbose-code-in-.patch
Normal file
@ -0,0 +1,107 @@
|
||||
From 326e7c65f07a6caee814eb1e385704aa1b5b129e Mon Sep 17 00:00:00 2001
|
||||
From: Crystal Wood <crwood@redhat.com>
|
||||
Date: Mon, 22 Jan 2024 16:13:21 -0600
|
||||
Subject: [PATCH 3/3] rt-tests: cyclicdeadline: Remove dead "verbose" code in
|
||||
print_stat()
|
||||
|
||||
print_stat() isn't and has never been called with verbose set, and
|
||||
that codepath doesn't even print anything. Remove it.
|
||||
|
||||
Signed-off-by: Crystal Wood <crwood@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
src/sched_deadline/cyclicdeadline.c | 46 ++++++++++-------------------
|
||||
1 file changed, 15 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
|
||||
index 3cb8f714b788..7525ad136d2c 100644
|
||||
--- a/src/sched_deadline/cyclicdeadline.c
|
||||
+++ b/src/sched_deadline/cyclicdeadline.c
|
||||
@@ -53,7 +53,6 @@ typedef int s32;
|
||||
/* Struct for statistics */
|
||||
struct thread_stat {
|
||||
unsigned long cycles;
|
||||
- unsigned long cyclesread;
|
||||
long min;
|
||||
long max;
|
||||
long act;
|
||||
@@ -64,8 +63,6 @@ struct thread_stat {
|
||||
int threadstarted;
|
||||
int tid;
|
||||
long reduce;
|
||||
- long redmax;
|
||||
- long cycleofmax;
|
||||
};
|
||||
|
||||
struct sched_data {
|
||||
@@ -775,36 +772,23 @@ static void print_hist(FILE *fp, struct sched_data *sd, int nthreads)
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
|
||||
-static void print_stat(FILE *fp, struct sched_data *sd, int index, int verbose, int quiet)
|
||||
+static void print_stat(FILE *fp, struct sched_data *sd, int index, int quiet)
|
||||
{
|
||||
struct thread_stat *stat = &sd->stat;
|
||||
+ char *fmt;
|
||||
|
||||
- if (!verbose) {
|
||||
- if (quiet != 1) {
|
||||
- char *fmt;
|
||||
- if (use_nsecs)
|
||||
- fmt = "T:%2d (%5d) I:%ld C:%7lu "
|
||||
- "Min:%7ld Act:%8ld Avg:%8ld Max:%8ld\n";
|
||||
- else
|
||||
- fmt = "T:%2d (%5d) I:%ld C:%7lu "
|
||||
- "Min:%7ld Act:%5ld Avg:%5ld Max:%8ld\n";
|
||||
- fprintf(fp, fmt, index, stat->tid,
|
||||
- sd->deadline_us, stat->cycles, stat->min, stat->act,
|
||||
- stat->cycles ?
|
||||
- (long)(stat->avg/stat->cycles) : 0, stat->max);
|
||||
- }
|
||||
- } else {
|
||||
- while (stat->cycles != stat->cyclesread) {
|
||||
- long diff = stat->values
|
||||
- [stat->cyclesread & sd->bufmsk];
|
||||
+ if (quiet)
|
||||
+ return;
|
||||
|
||||
- if (diff > stat->redmax) {
|
||||
- stat->redmax = diff;
|
||||
- stat->cycleofmax = stat->cyclesread;
|
||||
- }
|
||||
- stat->cyclesread++;
|
||||
- }
|
||||
- }
|
||||
+ if (use_nsecs)
|
||||
+ fmt = "T:%2d (%5d) I:%ld C:%7lu Min:%7ld Act:%8ld Avg:%8ld Max:%8ld\n";
|
||||
+ else
|
||||
+ fmt = "T:%2d (%5d) I:%ld C:%7lu Min:%7ld Act:%5ld Avg:%5ld Max:%8ld\n";
|
||||
+
|
||||
+ fprintf(fp, fmt, index, stat->tid,
|
||||
+ sd->deadline_us, stat->cycles, stat->min, stat->act,
|
||||
+ stat->cycles ?
|
||||
+ (long)(stat->avg/stat->cycles) : 0, stat->max);
|
||||
}
|
||||
|
||||
static u64 do_runtime(struct sched_data *sd, u64 period)
|
||||
@@ -1109,7 +1093,7 @@ static void loop(struct sched_data *sched_data, int nr_threads)
|
||||
|
||||
while (!shutdown) {
|
||||
for (i = 0; i < nr_threads; i++)
|
||||
- print_stat(stdout, &sched_data[i], i, 0, quiet);
|
||||
+ print_stat(stdout, &sched_data[i], i, quiet);
|
||||
usleep(10000);
|
||||
if (!quiet)
|
||||
printf("\033[%dA", nr_threads);
|
||||
@@ -1119,7 +1103,7 @@ static void loop(struct sched_data *sched_data, int nr_threads)
|
||||
printf("\033[%dB", nr_threads + 2);
|
||||
} else if (!histogram) {
|
||||
for (i = 0; i < nr_threads; ++i)
|
||||
- print_stat(stdout, &sched_data[i], i, 0, 0);
|
||||
+ print_stat(stdout, &sched_data[i], i, 0);
|
||||
}
|
||||
|
||||
if (histogram) {
|
||||
--
|
||||
2.43.0
|
||||
|
62
rt-tests-cyclics-Fix-json-segfault-when-not-using-hi.patch
Normal file
62
rt-tests-cyclics-Fix-json-segfault-when-not-using-hi.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 36f634cf8853e00558512b5b48ce600b629402bb Mon Sep 17 00:00:00 2001
|
||||
From: Crystal Wood <crwood@redhat.com>
|
||||
Date: Mon, 22 Jan 2024 16:13:19 -0600
|
||||
Subject: [PATCH 1/3] rt-tests: cyclics: Fix json segfault when not using
|
||||
histogram
|
||||
|
||||
If we're not generating a histogram, don't call the histogram code with
|
||||
a NULL pointer. Also don't print the rest of the histogram json node.
|
||||
|
||||
Signed-off-by: Crystal Wood <crwood@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
src/cyclictest/cyclictest.c | 11 ++++++-----
|
||||
src/sched_deadline/cyclicdeadline.c | 9 +++++----
|
||||
2 files changed, 11 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
|
||||
index 6169170fc66d..33fac3b95f5d 100644
|
||||
--- a/src/cyclictest/cyclictest.c
|
||||
+++ b/src/cyclictest/cyclictest.c
|
||||
@@ -1778,12 +1778,13 @@ static void write_stats(FILE *f, void *data __attribute__ ((unused)))
|
||||
fprintf(f, " \"resolution_in_ns\": %u,\n", use_nsecs);
|
||||
fprintf(f, " \"thread\": {\n");
|
||||
for (i = 0; i < num_threads; i++) {
|
||||
- fprintf(f, " \"%u\": {\n", i);
|
||||
-
|
||||
- fprintf(f, " \"histogram\": {");
|
||||
s = par[i]->stats;
|
||||
- hist_print_json(par[i]->stats->hist, f);
|
||||
- fprintf(f, " },\n");
|
||||
+ fprintf(f, " \"%u\": {\n", i);
|
||||
+ if (s->hist) {
|
||||
+ fprintf(f, " \"histogram\": {");
|
||||
+ hist_print_json(s->hist, f);
|
||||
+ fprintf(f, " },\n");
|
||||
+ }
|
||||
fprintf(f, " \"cycles\": %ld,\n", s->cycles);
|
||||
fprintf(f, " \"min\": %ld,\n", s->min);
|
||||
fprintf(f, " \"max\": %ld,\n", s->max);
|
||||
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
|
||||
index e449be57870e..b3155547b9bb 100644
|
||||
--- a/src/sched_deadline/cyclicdeadline.c
|
||||
+++ b/src/sched_deadline/cyclicdeadline.c
|
||||
@@ -1141,10 +1141,11 @@ static void write_stats(FILE *f, void *data)
|
||||
for (i = 0; i < nr_threads; i++) {
|
||||
s = &sd[i].stat;
|
||||
fprintf(f, " \"%u\": {\n", i);
|
||||
-
|
||||
- fprintf(f, " \"histogram\": {");
|
||||
- hist_print_json(s->hist, f);
|
||||
- fprintf(f, " },\n");
|
||||
+ if (s->hist) {
|
||||
+ fprintf(f, " \"histogram\": {");
|
||||
+ hist_print_json(s->hist, f);
|
||||
+ fprintf(f, " },\n");
|
||||
+ }
|
||||
fprintf(f, " \"cycles\": %ld,\n", s->cycles);
|
||||
fprintf(f, " \"min\": %ld,\n", s->min);
|
||||
fprintf(f, " \"max\": %ld,\n", s->max);
|
||||
--
|
||||
2.43.0
|
||||
|
Loading…
Reference in New Issue
Block a user