Linux-rt-users archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>,
	 Chuck Newman <chuck.newman@hpe.com>
Subject: Re: [PATCH] rt-tests: oslat: convert to nanoseconds correctly
Date: Fri, 2 Feb 2024 11:34:11 -0500 (EST)	[thread overview]
Message-ID: <0a607b79-846b-f55b-a891-d00c3e630baf@redhat.com> (raw)
In-Reply-To: <ZbvZ/l9zKjU8Frvy@tpad>



On Thu, 1 Feb 2024, Marcelo Tosatti wrote:

> 
> 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>
> 
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index 4bdca64..13e887d 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";
> 
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>


      reply	other threads:[~2024-02-02 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 17:50 [PATCH] rt-tests: oslat: convert to nanoseconds correctly Marcelo Tosatti
2024-02-02 16:34 ` John Kacur [this message]

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=0a607b79-846b-f55b-a891-d00c3e630baf@redhat.com \
    --to=jkacur@redhat.com \
    --cc=chuck.newman@hpe.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).