From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbcBWNSC (ORCPT ); Tue, 23 Feb 2016 08:18:02 -0500 Received: from smtprelay0080.hostedemail.com ([216.40.44.80]:50911 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752242AbcBWNSA (ORCPT ); Tue, 23 Feb 2016 08:18:00 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:1963:2393:2553:2559:2562:3138:3139:3140:3141:3142:3308:3352:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:5007:6119:6261:7576:7875:7903:7974:10004:10400:10848:10967:11026:11232:11473:11658:11914:12114:12517:12519:12740:13069:13161:13229:13255:13311:13357:14659:21080:30034:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: home07_459523b29181f X-Filterd-Recvd-Size: 2079 Date: Tue, 23 Feb 2016 08:17:57 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Juri Lelli , Clark Williams , Andrew Morton Subject: Re: [PATCH 4/4] tracing: Add __print_ns_to_secs() and __print_ns_without_secs() helpers Message-ID: <20160223081757.59f3b698@gandalf.local.home> In-Reply-To: <20160223124915.GQ6357@twins.programming.kicks-ass.net> References: <20160222212649.485719441@goodmis.org> <20160222212825.900322488@goodmis.org> <20160223124915.GQ6357@twins.programming.kicks-ass.net> X-Mailer: Claws Mail 3.13.1 (GTK+ 2.24.29; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Feb 2016 13:49:15 +0100 Peter Zijlstra wrote: > On Mon, Feb 22, 2016 at 04:26:53PM -0500, Steven Rostedt wrote: > > From: "Steven Rostedt (Red Hat)" > > > > 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. -- Steve