public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Juri Lelli <juri.lelli@gmail.com>,
	Clark Williams <williams@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 4/4] tracing: Add __print_ns_to_secs() and __print_ns_without_secs() helpers
Date: Tue, 23 Feb 2016 15:01:43 +0100	[thread overview]
Message-ID: <20160223140143.GK6356@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160223081757.59f3b698@gandalf.local.home>

On Tue, Feb 23, 2016 at 08:17:57AM -0500, Steven Rostedt wrote:
> On Tue, 23 Feb 2016 13:49:15 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > On Mon, Feb 22, 2016 at 04:26:53PM -0500, Steven Rostedt wrote:
> > > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > > 
> > > To have nanosecond output displayed in a more human readable format, its
> > > nicer to convert it to a seconds format (XXX.YYYYYYYYY). The problem is that
> > > to do so, the numbers must be divided by NSEC_PER_SEC, and moded too. But as
> > > these numbers are 64 bit, this can not be done simply with '/' and '%'
> > > operators, but must use do_div() instead.  
> > 
> > Would not div_[us]64_rem() make more sense? It would typically result in
> > just the one division, instead of two.
> 
> The problem is, how do you do that in a printf() statement?
> 
> We have "%llu.%09ul" which is two arguments in the printf(). And the
> values we are processing can't be modified. Which is why the macro uses
> ({ }) and creates a temp variable.

Hurm,. yes that's not something easily done. We need a temporary limited
in scope to the printf statement, and C doesn't really do that.

  reply	other threads:[~2016-02-23 14:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 21:26 [PATCH 0/4] sched: Display deadline bandwidth and other SCHED_DEBUG clean up Steven Rostedt
2016-02-22 21:26 ` [PATCH 1/4] sched: Move sched_feature file setup into debug.c Steven Rostedt
2016-02-29 11:16   ` [tip:sched/core] sched/debug: Move the /sys/kernel/debug/sched_features " tip-bot for Steven Rostedt (Red Hat)
2016-02-22 21:26 ` [PATCH 2/4] sched: Move sched_domain_sysctl to debug.c Steven Rostedt
2016-02-29 11:16   ` [tip:sched/core] sched/debug: " tip-bot for Steven Rostedt (Red Hat)
2016-02-22 21:26 ` [PATCH 3/4] sched: Add bandwidth ratio to /proc/sched_debug Steven Rostedt
2016-02-23  9:55   ` Juri Lelli
2016-02-29 11:16   ` [tip:sched/core] sched/debug: Add deadline scheduler " tip-bot for Steven Rostedt (Red Hat)
2016-02-22 21:26 ` [PATCH 4/4] tracing: Add __print_ns_to_secs() and __print_ns_without_secs() helpers Steven Rostedt
2016-02-23 12:49   ` Peter Zijlstra
2016-02-23 13:17     ` Steven Rostedt
2016-02-23 14:01       ` Peter Zijlstra [this message]
2016-02-23 14:30         ` Steven Rostedt

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=20160223140143.GK6356@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=juri.lelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=williams@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