linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: akpm@linux-foundation.org
Cc: tglx@linutronix.de, hpa@zytor.com, mingo@elte.hu,
	sboyd@codeaurora.org, rmk@arm.linux.org.uk, voice.shen@atmel.com,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [patch 1/3] sched_clock: document 4Mhz vs 1Mhz decision
Date: Tue, 19 Nov 2013 09:40:06 +0100	[thread overview]
Message-ID: <20131119084006.GC1243@gmail.com> (raw)
In-Reply-To: <20131115221529.43E8B1CA1A1@corp2gmr1-1.eem.corp.google.com>


* akpm@linux-foundation.org <akpm@linux-foundation.org> wrote:

> From: Stephen Boyd <sboyd@codeaurora.org>
> Subject: sched_clock: document 4Mhz vs 1Mhz decision
> 
> Bo Shen sent a patch to change this to 1Mhz instead of 4Mhz but according
> to Russell King the use of 4Mhz was intentional.  Add a comment to this
> effect so that others don't try to change the code as well.
> 
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Bo Shen <voice.shen@atmel.com>
> Cc: Russell King <rmk@arm.linux.org.uk>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/time/sched_clock.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff -puN kernel/time/sched_clock.c~sched_clock-document-4mhz-vs-1mhz-decision kernel/time/sched_clock.c
> --- a/kernel/time/sched_clock.c~sched_clock-document-4mhz-vs-1mhz-decision
> +++ a/kernel/time/sched_clock.c
> @@ -132,6 +132,10 @@ void __init sched_clock_register(u64 (*r
>  	clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 3600);
>  
>  	r = rate;
> +	/*
> +	 * Use 4MHz instead of 1MHz so that things like 1.832Mhz show as
> +	 * 1832Khz
> +	 */
>  	if (r >= 4000000) {
>  		r /= 1000000;
>  		r_unit = 'M';

Instead of magic precision cutoff limits the better solution would be 
to simply display not just decimal part but also the first 3 digits of 
the fractional part:

          1.123  Hz
	990.134 kHz
	  1.832 MHz
	 12.314 GHz

etc. - then every number could be displayed in its natural unit 
without magic precision limits.

It would also be mostly self-documenting.

Thanks,

	Ingo

           reply	other threads:[~2013-11-19  8:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20131115221529.43E8B1CA1A1@corp2gmr1-1.eem.corp.google.com>]

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=20131119084006.GC1243@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rmk@arm.linux.org.uk \
    --cc=sboyd@codeaurora.org \
    --cc=tglx@linutronix.de \
    --cc=voice.shen@atmel.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 NNTP newsgroup(s).