* [PATCH] rt-tests: cyclics: Omit empty histogram buckets
@ 2024-05-01 20:49 Crystal Wood
2024-05-02 19:13 ` John Kacur
0 siblings, 1 reply; 4+ messages in thread
From: Crystal Wood @ 2024-05-01 20:49 UTC (permalink / raw
To: John Kacur, Clark Williams; +Cc: linux-rt-users, Crystal Wood
This makes the output more palatable for human readers, at the expense
of requiring other consumers of the data to be able to handle the missing
lines.
Signed-off-by: Crystal Wood <crwood@redhat.com>
---
Don't apply until the below patch has been merged in rteval:
https://lore.kernel.org/linux-rt-users/20240501200922.226347-1-crwood@redhat.com/
---
src/cyclictest/cyclictest.c | 6 +++---
src/include/histogram.h | 4 ++--
src/lib/histogram.c | 15 ++++++++++++---
src/sched_deadline/cyclicdeadline.c | 7 +++----
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 8a963392e639..c5c33898c63c 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1340,13 +1340,13 @@ static void print_hist(struct thread_param *par[], int nthreads)
fprintf(fd, "# Histogram\n");
for (i = 0; i < histogram; i++) {
unsigned long flags = 0;
+ char buf[64];
- fprintf(fd, "%06d ", i);
+ snprintf(buf, sizeof(buf), "%06d ", i);
if (histofall)
flags |= HSET_PRINT_SUM;
- hset_print_bucket(&hset, fd, i, flags);
- fprintf(fd, "\n");
+ hset_print_bucket(&hset, fd, buf, i, flags);
}
fprintf(fd, "# Min Latencies:");
for (j = 0; j < nthreads; j++)
diff --git a/src/include/histogram.h b/src/include/histogram.h
index c7aba68ffb99..31fe2a08eda0 100644
--- a/src/include/histogram.h
+++ b/src/include/histogram.h
@@ -36,7 +36,7 @@ int hist_sample(struct histogram *h, uint64_t sample);
int hset_init(struct histoset *hs, unsigned long histos, unsigned long bucket_width,
unsigned long num_buckets, unsigned long overflow);
void hset_destroy(struct histoset *hs);
-void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
- unsigned long flags);
+void hset_print_bucket(struct histoset *hs, FILE *f, const char *pre,
+ unsigned long bucket, unsigned long flags);
void hist_print_json(struct histogram *h, FILE *f);
void hist_print_oflows(struct histogram *h, FILE *f);
diff --git a/src/lib/histogram.c b/src/lib/histogram.c
index 35a9d604da86..c21fc49c0a6c 100644
--- a/src/lib/histogram.c
+++ b/src/lib/histogram.c
@@ -114,8 +114,8 @@ void hset_destroy(struct histoset *hs)
hs->histos = NULL;
}
-void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
- unsigned long flags)
+void hset_print_bucket(struct histoset *hs, FILE *f, const char *pre,
+ unsigned long bucket, unsigned long flags)
{
unsigned long long sum = 0;
unsigned long i;
@@ -123,10 +123,17 @@ void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
if (bucket >= hs->num_buckets)
return;
+ for (i = 0; i < hs->num_histos; i++)
+ sum += hs->histos[i].buckets[bucket];
+
+ if (sum == 0)
+ return;
+ if (pre)
+ fprintf(f, "%s", pre);
+
for (i = 0; i < hs->num_histos; i++) {
unsigned long val = hs->histos[i].buckets[bucket];
- sum += val;
if (i != 0)
fprintf(f, "\t");
fprintf(f, "%06lu", val);
@@ -134,6 +141,8 @@ void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
if (flags & HSET_PRINT_SUM)
fprintf(f, "\t%06llu", sum);
+
+ fprintf(f, "\n");
}
void hist_print_json(struct histogram *h, FILE *f)
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 7525ad136d2c..631d57ee885e 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -731,11 +731,10 @@ static void print_hist(FILE *fp, struct sched_data *sd, int nthreads)
fprintf(fp, "# Histogram\n");
for (i = 0; i < histogram; i++) {
unsigned long flags = 0;
+ char buf[64];
- fprintf(fp, "%06d ", i);
-
- hset_print_bucket(&hset, fp, i, flags);
- fprintf(fp, "\n");
+ snprintf(buf, sizeof(buf), "%06d ", i);
+ hset_print_bucket(&hset, fp, buf, i, flags);
}
fprintf(fp, "# Min Latencies:");
for (i = 0; i < nthreads; i++)
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rt-tests: cyclics: Omit empty histogram buckets
2024-05-01 20:49 [PATCH] rt-tests: cyclics: Omit empty histogram buckets Crystal Wood
@ 2024-05-02 19:13 ` John Kacur
2024-05-02 20:11 ` Crystal Wood
0 siblings, 1 reply; 4+ messages in thread
From: John Kacur @ 2024-05-02 19:13 UTC (permalink / raw
To: Crystal Wood; +Cc: Clark Williams, linux-rt-users
On Wed, 1 May 2024, Crystal Wood wrote:
> This makes the output more palatable for human readers, at the expense
> of requiring other consumers of the data to be able to handle the missing
> lines.
>
> Signed-off-by: Crystal Wood <crwood@redhat.com>
> ---
> Don't apply until the below patch has been merged in rteval:
> https://lore.kernel.org/linux-rt-users/20240501200922.226347-1-crwood@redhat.com/
> ---
> src/cyclictest/cyclictest.c | 6 +++---
> src/include/histogram.h | 4 ++--
> src/lib/histogram.c | 15 ++++++++++++---
> src/sched_deadline/cyclicdeadline.c | 7 +++----
> 4 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 8a963392e639..c5c33898c63c 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1340,13 +1340,13 @@ static void print_hist(struct thread_param *par[], int nthreads)
> fprintf(fd, "# Histogram\n");
> for (i = 0; i < histogram; i++) {
> unsigned long flags = 0;
> + char buf[64];
>
> - fprintf(fd, "%06d ", i);
> + snprintf(buf, sizeof(buf), "%06d ", i);
>
> if (histofall)
> flags |= HSET_PRINT_SUM;
> - hset_print_bucket(&hset, fd, i, flags);
> - fprintf(fd, "\n");
> + hset_print_bucket(&hset, fd, buf, i, flags);
> }
> fprintf(fd, "# Min Latencies:");
> for (j = 0; j < nthreads; j++)
> diff --git a/src/include/histogram.h b/src/include/histogram.h
> index c7aba68ffb99..31fe2a08eda0 100644
> --- a/src/include/histogram.h
> +++ b/src/include/histogram.h
> @@ -36,7 +36,7 @@ int hist_sample(struct histogram *h, uint64_t sample);
> int hset_init(struct histoset *hs, unsigned long histos, unsigned long bucket_width,
> unsigned long num_buckets, unsigned long overflow);
> void hset_destroy(struct histoset *hs);
> -void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
> - unsigned long flags);
> +void hset_print_bucket(struct histoset *hs, FILE *f, const char *pre,
> + unsigned long bucket, unsigned long flags);
> void hist_print_json(struct histogram *h, FILE *f);
> void hist_print_oflows(struct histogram *h, FILE *f);
> diff --git a/src/lib/histogram.c b/src/lib/histogram.c
> index 35a9d604da86..c21fc49c0a6c 100644
> --- a/src/lib/histogram.c
> +++ b/src/lib/histogram.c
> @@ -114,8 +114,8 @@ void hset_destroy(struct histoset *hs)
> hs->histos = NULL;
> }
>
> -void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
> - unsigned long flags)
> +void hset_print_bucket(struct histoset *hs, FILE *f, const char *pre,
> + unsigned long bucket, unsigned long flags)
> {
> unsigned long long sum = 0;
> unsigned long i;
> @@ -123,10 +123,17 @@ void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
> if (bucket >= hs->num_buckets)
> return;
>
> + for (i = 0; i < hs->num_histos; i++)
> + sum += hs->histos[i].buckets[bucket];
> +
> + if (sum == 0)
> + return;
> + if (pre)
> + fprintf(f, "%s", pre);
> +
> for (i = 0; i < hs->num_histos; i++) {
> unsigned long val = hs->histos[i].buckets[bucket];
>
> - sum += val;
> if (i != 0)
> fprintf(f, "\t");
> fprintf(f, "%06lu", val);
> @@ -134,6 +141,8 @@ void hset_print_bucket(struct histoset *hs, FILE *f, unsigned long bucket,
>
> if (flags & HSET_PRINT_SUM)
> fprintf(f, "\t%06llu", sum);
> +
> + fprintf(f, "\n");
> }
>
> void hist_print_json(struct histogram *h, FILE *f)
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 7525ad136d2c..631d57ee885e 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -731,11 +731,10 @@ static void print_hist(FILE *fp, struct sched_data *sd, int nthreads)
> fprintf(fp, "# Histogram\n");
> for (i = 0; i < histogram; i++) {
> unsigned long flags = 0;
> + char buf[64];
>
> - fprintf(fp, "%06d ", i);
> -
> - hset_print_bucket(&hset, fp, i, flags);
> - fprintf(fp, "\n");
> + snprintf(buf, sizeof(buf), "%06d ", i);
> + hset_print_bucket(&hset, fp, buf, i, flags);
> }
> fprintf(fp, "# Min Latencies:");
> for (i = 0; i < nthreads; i++)
> --
Fixed title to say: rt-tests: cyclictest: Omit empty histogram buckets
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rt-tests: cyclics: Omit empty histogram buckets
2024-05-02 19:13 ` John Kacur
@ 2024-05-02 20:11 ` Crystal Wood
2024-05-03 21:24 ` John Kacur
0 siblings, 1 reply; 4+ messages in thread
From: Crystal Wood @ 2024-05-02 20:11 UTC (permalink / raw
To: John Kacur; +Cc: Clark Williams, linux-rt-users
On Thu, 2024-05-02 at 15:13 -0400, John Kacur wrote:
>
>
> On Wed, 1 May 2024, Crystal Wood wrote:
>
> > This makes the output more palatable for human readers, at the expense
> > of requiring other consumers of the data to be able to handle the
> > missing
> > lines.
> >
> > Signed-off-by: Crystal Wood <crwood@redhat.com>
> > ---
> > Don't apply until the below patch has been merged in rteval:
> > https://lore.kernel.org/linux-rt-users/20240501200922.226347-1-crwood@redhat.com/
> > ---
> > src/cyclictest/cyclictest.c | 6 +++---
> > src/include/histogram.h | 4 ++--
> > src/lib/histogram.c | 15 ++++++++++++---
> > src/sched_deadline/cyclicdeadline.c | 7 +++----
> > 4 files changed, 20 insertions(+), 12 deletions(-)
> >
> >
> Fixed title to say: rt-tests: cyclictest: Omit empty histogram buckets
> Signed-off-by: John Kacur <jkacur@redhat.com>
>
How is that a fix? I said "cyclics" because it's both cyclictest and
cyclicdeadline.
-Crystal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rt-tests: cyclics: Omit empty histogram buckets
2024-05-02 20:11 ` Crystal Wood
@ 2024-05-03 21:24 ` John Kacur
0 siblings, 0 replies; 4+ messages in thread
From: John Kacur @ 2024-05-03 21:24 UTC (permalink / raw
To: Crystal Wood; +Cc: Clark Williams, linux-rt-users
[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]
On Thu, 2 May 2024, Crystal Wood wrote:
> On Thu, 2024-05-02 at 15:13 -0400, John Kacur wrote:
> >
> >
> > On Wed, 1 May 2024, Crystal Wood wrote:
> >
> > > This makes the output more palatable for human readers, at the expense
> > > of requiring other consumers of the data to be able to handle the
> > > missing
> > > lines.
> > >
> > > Signed-off-by: Crystal Wood <crwood@redhat.com>
> > > ---
> > > Don't apply until the below patch has been merged in rteval:
> > > https://lore.kernel.org/linux-rt-users/20240501200922.226347-1-crwood@redhat.com/
> > > ---
> > > src/cyclictest/cyclictest.c | 6 +++---
> > > src/include/histogram.h | 4 ++--
> > > src/lib/histogram.c | 15 ++++++++++++---
> > > src/sched_deadline/cyclicdeadline.c | 7 +++----
> > > 4 files changed, 20 insertions(+), 12 deletions(-)
> > >
> > >
> > Fixed title to say: rt-tests: cyclictest: Omit empty histogram buckets
> > Signed-off-by: John Kacur <jkacur@redhat.com>
> >
>
> How is that a fix? I said "cyclics" because it's both cyclictest and
> cyclicdeadline.
>
> -Crystal
That's kind of funny. You ARE making up words there, I jut assumed it was
a typo. I've already pushed it upstream though, so we will have to let it
be.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-03 21:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01 20:49 [PATCH] rt-tests: cyclics: Omit empty histogram buckets Crystal Wood
2024-05-02 19:13 ` John Kacur
2024-05-02 20:11 ` Crystal Wood
2024-05-03 21:24 ` John Kacur
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.